mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-06 18:15:17 +00:00
Fix #602
This commit is contained in:
parent
e4894d27ad
commit
7379a44b8c
@ -52,11 +52,15 @@ class NotificationList(ListView):
|
|||||||
template_name = "core/notification_list.jinja"
|
template_name = "core/notification_list.jinja"
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
if self.request.user.is_anonymous:
|
||||||
|
return []
|
||||||
|
|
||||||
# TODO: Bulk update in django 2.2
|
# TODO: Bulk update in django 2.2
|
||||||
if "see_all" in self.request.GET.keys():
|
if "see_all" in self.request.GET.keys():
|
||||||
for n in self.request.user.notifications.filter(viewed=False):
|
for n in self.request.user.notifications.filter(viewed=False):
|
||||||
n.viewed = True
|
n.viewed = True
|
||||||
n.save()
|
n.save()
|
||||||
|
|
||||||
return self.request.user.notifications.order_by("-date")[:20]
|
return self.request.user.notifications.order_by("-date")[:20]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user