Comment bdd optimisations

This commit is contained in:
loulous27 2025-11-27 09:18:57 +01:00
parent 6dd56b94ef
commit a4cdcd4039

View file

@ -149,6 +149,11 @@ class GalleryDetailView(LoginRequiredMixin, DetailView):
# List owners # List owners
context["owners"] = [] context["owners"] = []
#owners_pk_distinct = context["photos"].order_by('owner__pk').values_list('owner__pk', flat=True).distinct()
#context["owners"] = User.objects.filter(pk__in=owners_pk_distinct)
for photo in context["photos"]: for photo in context["photos"]:
if photo.owner not in context["owners"]: if photo.owner not in context["owners"]:
context["owners"].append(photo.owner) context["owners"].append(photo.owner)