mirror of
https://github.com/ae-utbm/sith.git
synced 2026-10-31 06:39:31 +00:00
fix permanent notification callback
This commit is contained in:
1 parent
d58c713fc5
commit
c07f0c33cb
3 files changed
+39
-11
No files matched your search
+5
-2
@@ -160,9 +160,12 @@ class News(models.Model):
|
||||
)
|
||||
|
||||
|
||||
def news_notification_callback(notif):
|
||||
def news_notification_callback(notif: Notification):
|
||||
# the NewsDate linked to the News
|
||||
# which creation triggered this callback may not exist yet,
|
||||
# so it's important to filter by "not past date" rather than by "future date"
|
||||
count = News.objects.filter(
|
||||
dates__start_date__gt=timezone.now(), is_published=False
|
||||
~Q(dates__start_date__gt=timezone.now()), is_published=False
|
||||
).count()
|
||||
if count:
|
||||
notif.viewed = False
|
||||
|
||||
Reference in new issue
Block a user