Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions heythere/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
class NotificationForm(forms.ModelForm):
class Meta:
model = Notification
fields = {'notification_type', 'user', 'headline', 'body', 'headline_dict', 'body_dict', 'active', 'sent_at'}

def __init__(self, *args, **kwargs):
super(NotificationForm, self).__init__(*args, **kwargs)
Expand Down
15 changes: 8 additions & 7 deletions heythere/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def read(self):


class NotificationManager(models.Manager):
def get_query_set(self):
def get_queryset(self):
return NotificationQuerySet(self.model, using=self._db)

def create_notification(self, user, notification_type, headline, body):
Expand All @@ -49,7 +49,7 @@ def create_notification(self, user, notification_type, headline, body):
return notification

def for_user(self, user):
return self.get_query_set().filter(user=user)
return self.get_queryset().filter(user=user)

def clear_all(self, user):
notifications = self.model.objects.select_for_update().for_user(user)
Expand All @@ -67,19 +67,19 @@ def send_all_unsent(self, fail_silently=False):
note.save()

def all_unsent(self):
return self.get_query_set().unsent()
return self.get_queryset().unsent()

def unread(self, user):
return self.get_query_set().for_user(user).unread()
return self.get_queryset().for_user(user).unread()

def read(self, user):
return self.get_query_set().for_user(user).read()
return self.get_queryset().for_user(user).read()

def unsent(self, user):
return self.get_query_set().for_user(user).unsent()
return self.get_queryset().for_user(user).unsent()

def sent(self, user):
return self.get_query_set().for_user(user).sent()
return self.get_queryset().for_user(user).sent()


class Notification(models.Model):
Expand Down Expand Up @@ -169,3 +169,4 @@ def send_email(self, fail_silently=False):
send_mail(*self.mail_tuple, fail_silently=fail_silently)
self.sent_at = now()
self.save()