random.sample don't take sets anymore

This commit is contained in:
Alexandre Iooss 2023-08-05 12:34:59 +02:00
parent 4ff97d09fa
commit 3b1056b3ae

View file

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