random.sample on list rather than set

This commit is contained in:
Alexandre Iooss 2023-08-05 12:37:15 +02:00
parent 3b1056b3ae
commit 35251c9e0a

View file

@ -190,7 +190,7 @@ class Gallery(models.Model):
photo_set = self.photos.filter(is_public=True)
else:
photo_set = self.photos
return random.sample(sorted(set(photo_set)), count)
return random.sample(list(photo_set), count)
def photo_count(self, public=True):
"""Return a count of all the photos in this gallery."""