From 35251c9e0a910816144d66bc8183f95e0261d862 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sat, 5 Aug 2023 12:37:15 +0200 Subject: [PATCH] random.sample on list rather than set --- photologue/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/photologue/models.py b/photologue/models.py index 94b8a2e..275d8fb 100644 --- a/photologue/models.py +++ b/photologue/models.py @@ -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."""