Skip to content

Commit

Permalink
added missing function
Browse files Browse the repository at this point in the history
  • Loading branch information
paltman committed Jun 23, 2011
1 parent 26479c5 commit c8949ab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions notification/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ def for_user(cls, user, notice_type, medium):
return setting


def get_notification_setting(user, notice_type, medium):
try:
return NoticeSetting.objects.get(user=user, notice_type=notice_type, medium=medium)
except NoticeSetting.DoesNotExist:
default = (NOTICE_MEDIA_DEFAULTS[medium] <= notice_type.default)
setting = NoticeSetting(user=user, notice_type=notice_type, medium=medium, send=default)
setting.save()
return setting


class NoticeQueueBatch(models.Model):
"""
A queued notice.
Expand Down

0 comments on commit c8949ab

Please sign in to comment.