@login_required()
def app_notification_list_view(request: WSGIRequest) -> TemplateResponse:
(
AppNotification.objects
.active()
.is_sent()
.annotate_is_viewed_by_user(request.user)
.select_related('notification')
.distinct()
.process_session_filter(
request=request,
session_key=NOTIFICATION_FILTERING_SESSION_KEY_NAME,
form_class=NotificationListFilterForm,
)
)
return portal_views.list_view(
request,
context_data={
'notification_endpoint': reverse('django_spire:notification:app:template:scroll_items'),
'filter_session': SessionController(request, NOTIFICATION_FILTERING_SESSION_KEY_NAME),
'priority_choices': json.dumps(NotificationPriorityChoices.choices[::-1]),
},
model=AppNotification,
template='django_spire/notification/app/page/list_page.html'
)