mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-06 18:15:17 +00:00
Update core/views/site.py
Co-Authored-By: thomas girod <56346771+imperosol@users.noreply.github.com>
This commit is contained in:
parent
f52ec66946
commit
d347b95153
@ -31,6 +31,7 @@ from django.utils import html
|
|||||||
from django.views.generic import ListView, TemplateView
|
from django.views.generic import ListView, TemplateView
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
|
from django.db.models.query import QuerySet
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@ -51,10 +52,9 @@ class NotificationList(ListView):
|
|||||||
model = Notification
|
model = Notification
|
||||||
template_name = "core/notification_list.jinja"
|
template_name = "core/notification_list.jinja"
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self) -> QuerySet[Notification]:
|
||||||
if self.request.user.is_anonymous:
|
if self.request.user.is_anonymous:
|
||||||
return []
|
return Notification.objects.none()
|
||||||
|
|
||||||
# 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):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user