I have a Django site that i'm managing for a client of mine that is around 5 years old. It has a very simple carousel on one of the pages that is content managed. THe client wants these images to be randomly picked on page load as opposed to the order in which they are organised in the CMS. Here is the code for the models for this element
from django.db import models
class Banner(models.Model):
created = models.DateTimeField(auto_now_add=True)
active = models.BooleanField(default=True, help_text='Display this banner on the website.')
title = models.CharField(max_length=255)
description = models.TextField()
image = models.ImageField(upload_to='banners/')
order = models.IntegerField(default=0)
class Meta:
ordering = ['order']
I was wondering if someone could help me by showing me how to do this or if it's even possible? This, in my opinion, is different from the suggested link as it does not show how to address this problem specifically.