mirror of
https://github.com/Hopiu/django-notifications.git
synced 2026-03-16 21:30:24 +00:00
sent/unsent convenience functions
This commit is contained in:
parent
0039065461
commit
f7f90b83c8
1 changed files with 12 additions and 0 deletions
|
|
@ -40,6 +40,12 @@ def assert_soft_delete():
|
|||
|
||||
class NotificationQuerySet(models.query.QuerySet):
|
||||
|
||||
def unsent(self):
|
||||
return self.filter(emailed=False)
|
||||
|
||||
def sent(self):
|
||||
return self.filter(emailed=True)
|
||||
|
||||
def unread(self, include_deleted=False):
|
||||
"""Return only unread items in the current queryset"""
|
||||
if is_soft_delete() and not include_deleted:
|
||||
|
|
@ -117,6 +123,12 @@ class NotificationQuerySet(models.query.QuerySet):
|
|||
|
||||
return qs.update(deleted=False)
|
||||
|
||||
def mark_as_unsent(self):
|
||||
return self.update(emailed=False)
|
||||
|
||||
def mark_as_sent(self):
|
||||
return self.update(emailed=True)
|
||||
|
||||
|
||||
class Notification(models.Model):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue