On autorise a voir les élections dont on est l'admin
This commit is contained in:
parent
2cf4315eaa
commit
363b181d22
1 changed files with 6 additions and 6 deletions
|
@ -364,12 +364,12 @@ class ElectionView(DetailView):
|
|||
return context
|
||||
|
||||
def get_queryset(self):
|
||||
return (
|
||||
super()
|
||||
.get_queryset()
|
||||
.filter(archived=False)
|
||||
.prefetch_related("questions__options")
|
||||
)
|
||||
user = self.request.user
|
||||
qs = super().get_queryset().prefetch_related("questions__options")
|
||||
if user.is_authenticated:
|
||||
return qs.filter(Q(archived=False) | Q(created_by=user))
|
||||
|
||||
return qs.filter(archived=False)
|
||||
|
||||
|
||||
class ElectionVotersView(DetailView):
|
||||
|
|
Loading…
Reference in a new issue