diff --git a/elections/views.py b/elections/views.py index ec26e4d..7fd0012 100644 --- a/elections/views.py +++ b/elections/views.py @@ -334,11 +334,12 @@ class ElectionListView(ListView): template_name = "elections/election_list.html" def get_queryset(self): - return ( - super() - .get_queryset() - .filter(Q(archived=False) | Q(created_by=self.request.user)) - ) + user = self.request.user + qs = super().get_queryset() + if user.is_authenticated: + return qs.filter(Q(archived=False) | Q(created_by=self.request.user)) + + return qs.filter(archived=False) class ElectionView(DetailView):