notification.api module

notification.api.get_notifications(request)[source]

Get all unread messages from a user.

Parameters:request – the request containing eventually a user
notification.api.add_notification_for(users, level, payload, tag='', date=None)[source]

Add a notification to a list of users.

Parameters:
  • users – an iterable containing the recipients of the notification.
  • level – a notification level (could be interpreted as priority)
  • payload – a dict containing a message, a tag, or a URL (should be serializable into JSON)
  • date – a date to deliver the notification on, by default: timezone.now()
notification.api.broadcast_notification(level, payload, tag='', date=None)[source]

Add a notifiation to all users (a.k.a. broadcast)

Parameters:
  • level – a notification level (could be interpreted as priority)
  • payload – a dict containing a message, a tag or a URL (should be serializable into JSON)
  • date – a date to deliver the notification on, by default: timezone.now()
notification.api.mark_read(user, notification)[source]

Mark the notification instance as read for the user provided.

Parameters:
  • user – user instance for the recipient
  • notification – a Notification instance to mark as read
notification.api.mark_all_read(user)[source]

Mark all the notifications instances as read for a user provided.

Parameters:user – user instance for the recipient
notification.api.delete_notification_per_tag(user, tag)[source]

Delete the notifications for the user and tag provided.

Parameters:
  • user – user instance for the recipient
  • tag – tag used to create the notification