So basically I have a table with 16 objects. I want to show only four of them on my website and want it to automatically rotate every week to another four and so on. I was thinking maybe a cronjob would do it, but I rather ask here before I take any action.
Here is my models.py
class Liturgicketexty(models.Model):
id = models.AutoField(primary_key=True)
text = models.CharField(max_length=45)
url = models.URLField(max_length=200, blank=True, null=True)
class Meta:
verbose_name_plural = 'Liturgické texty'
def __str__(self):
return self.text
and here is the part in html where I use this table.
<div id="table">
<table>
<thead>
<tr>
<th>Čtení na neděli</th>
</tr>
</thead>
<tbody>
{% for l in liturgicketexty %}
<tr>
<td><a href="{{ l.url }}">{{ l.text }}</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
If someone needs it.
Like I said. I tried to research some solution, but found nothing promising. If you find or know something I will be more than grateful.