On autorise a voir les élections dont on est l'admin

This commit is contained in:
Tom Hubrecht 2021-03-29 00:10:40 +02:00
parent 2cf4315eaa
commit 363b181d22

View file

@ -364,12 +364,12 @@ class ElectionView(DetailView):
return context return context
def get_queryset(self): def get_queryset(self):
return ( user = self.request.user
super() qs = super().get_queryset().prefetch_related("questions__options")
.get_queryset() if user.is_authenticated:
.filter(archived=False) return qs.filter(Q(archived=False) | Q(created_by=user))
.prefetch_related("questions__options")
) return qs.filter(archived=False)
class ElectionVotersView(DetailView): class ElectionVotersView(DetailView):