I'm trying to get a different article from my database of 10 articles using Django to be random every time the page is refreshed. Each article consists of four pieces of information:
article.pubDate
article.author
article.heroImage
article.body
I've used a for loop {% for article in object_list|slice:":1" %} to get a single article, but I don't know if there's something like random or shuffle that I can tack onto my for loop.
list.html
{% for article in object_list|slice:":1" %}
<div class="mainContent clearfix">
<h1>Top 10 Video Games</h1>
<p class="date">{{article.pubDate|date:"l, F j, Y" }}</p> | <a href="" class="author">{{article.author}}</a>
<img src="{{article.heroImage}}" alt="" class="mediumImage">
<p class="caption">{{article.body|truncatewords:"80"}}</p>
{% endfor %}