4.2.2.9. Package apps.widgets.notifications
¶
Provides the notification service.
-
apps.widgets.notifications.
get_unread_count
(user)[source]¶ Get the number of notifications that are unread.
-
apps.widgets.notifications.
get_unread_notifications
(user, limit=None)[source]¶ Retrieves the user’s unread notifications that are to be displayed on the web. Returns a dictionary containing their alerts, their unread notifications, and if there are more unread notifications.
-
apps.widgets.notifications.
get_user_alert_notifications
(user)[source]¶ Retrieves notifications that should be displayed in an alert.
4.2.2.9.1. Module apps.widgets.notifications.models
¶
Model definition for notification service.
-
class
apps.widgets.notifications.models.
NoticeTemplate
(*args, **kwargs)[source]¶ Templates for built in notifications.
Parameters: - id (AutoField) – Id
- notice_type (SlugField) – Notice type
- template (TextField) – Uses Markdown formatting. The available template variables are listed here.
-
apps.widgets.notifications.models.
TYPE_CHOICES
= (('round-transition', 'Round Transition'), ('raffle-winner', 'Raffle Winner'), ('prize-winner', 'Prize Winner'), ('commitment-ready', 'Commitment Ready'), ('prize-winner-receipt', 'Prize Winner Receipt Form'), ('raffle-winner-receipt', 'Raffle Winner Receipt Form'))¶ Possible notification types.
-
class
apps.widgets.notifications.models.
UserNotification
(*args, **kwargs)[source]¶ User Notification
Parameters: - id (AutoField) – Id
- recipient_id (ForeignKey) – The recipient of this notification.
- contents (TextField) – The content of the notification.
- unread (BooleanField) – Unread
- updated_at (DateTimeField) – Updated at
- created_at (DateTimeField) – Created at
- level (IntegerField) – The notification level, such as INFO or ERROR.
- display_alert (BooleanField) – If enabled, display the alert dialog box to user.
- content_type_id (ForeignKey) – Content type
- object_id (PositiveIntegerField) – Object id
-
static
create_email_notification
(recipient_email, subject, message, html_message=None)[source]¶ Create an email notification.
-
static
create_error_notification
(recipient, contents, display_alert=True, content_object=None)[source]¶ Create an error level notification.
-
static
create_info_notification
(recipient, contents, display_alert=False, content_object=None)[source]¶ Create an info level notification.
-
static
create_success_notification
(recipient, contents, display_alert=False, content_object=None)[source]¶ Create a success notification.
-
static
create_warning_notification
(recipient, contents, display_alert=True, content_object=None)[source]¶ Create a warning level notification.
-
icon_class
¶ Return the css class for the icon.
-
is_success
¶ Return true if success.
-
style_class
¶ Return the style class
4.2.2.9.2. Module apps.widgets.notifications.views
¶
Handle the requests for the notification widget.