views¶
Module: espressodb.notifications.views
|
View which displays notifications for logged in user and level. |
|
Post only view to add logged in user to has read list of notification. |
Views for notifications module.
-
class
HasReadView
(**kwargs)[source]¶ Post only view to add logged in user to has read list of notification.
-
static
get
(request, *args, **kwargs)[source]¶ Get accessed of view is removed.
- Raises
Http404 – When this function is called.
-
model
¶
-
post
(request, *args, **kwargs)[source]¶ Adds logged in user to read_by list of notfication if user is allowed to see it.
- Raises
Http404 – If user is not allowed to see notification.
- Return type
HttpResponseRedirect
-
success_url
¶ Go back to notification list view on success
-
static
-
class
NotificationsView
(**kwargs)[source]¶ View which displays notifications for logged in user and level.
-
get_context_data
(*, object_list=None, **kwargs)[source]¶ Parses context data of view.
Sets context view
level
to own view level. Sets contextall
option to true if specified as url parameter.
-
get_queryset
()[source]¶ Returns notifications which are vieawable by logged in user for current level.
- Return type
Union
[QuerySet
,List
[Notification
]]
-
level
= ''¶ Level of notifications to show. Must be one of
espressodb.notifications.models.LEVELS
. Shows notifications for all levels if not specified.
-
login_url
= '/login/'¶ Redirect user to login page if not logged in
-
model
¶
-
paginate_by
= 20¶ Paginate pages by
-
template_name
= 'notification_list.html'¶ The template file
-