From 6d65205c6940fcd6fcdefc1b91512502968914fb Mon Sep 17 00:00:00 2001 From: Matthew Schinckel Date: Wed, 24 Oct 2012 09:41:52 +1030 Subject: [PATCH] Fixed a bug where passing recipients was not really effective: it still marked all as read/unread based on the entire query set. --- notifications/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/notifications/models.py b/notifications/models.py index 659f202..f5a373c 100644 --- a/notifications/models.py +++ b/notifications/models.py @@ -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): """