mirror of
https://github.com/Hopiu/django-notifications.git
synced 2026-05-12 23:33:08 +00:00
Fixed a bug where passing recipients was not really effective: it still marked all as read/unread based on the entire query set.
This commit is contained in:
parent
ab0d062f30
commit
6d65205c69
1 changed files with 5 additions and 3 deletions
|
|
@ -23,16 +23,18 @@ class NotificationQuerySet(models.query.QuerySet):
|
|||
"Return only unread items in the current queryset"
|
||||
return self.filter(unread=True)
|
||||
|
||||
# Should we return self on these?
|
||||
# Should we return self on these?
|
||||
def mark_all_as_read(self, recipient=None):
|
||||
if recipient:
|
||||
self.filter(recipient=recipient).update(unread=False)
|
||||
self.update(unread=False)
|
||||
els:
|
||||
self.update(unread=False)
|
||||
|
||||
def mark_all_as_unread(self, recipient=None):
|
||||
if recipient:
|
||||
self.filter(recipient=recipient).update(unread=True)
|
||||
self.update(unread=True)
|
||||
else:
|
||||
self.update(unread=True)
|
||||
|
||||
class Notification(models.Model):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue