Coverage for website/pushnotifications/views.py: 70.00%
10 statements
« prev ^ index » next coverage.py v7.6.7, created at 2025-08-14 10:31 +0000
« prev ^ index » next coverage.py v7.6.7, created at 2025-08-14 10:31 +0000
1from django.contrib.admin.views.decorators import staff_member_required
2from django.contrib.auth.decorators import permission_required
3from django.shortcuts import get_object_or_404, redirect
5from pushnotifications.models import Message
8@staff_member_required
9@permission_required("pushnotifications.change_message")
10def admin_send(request, pk):
11 """Send the provided push notification.
13 :param request: the request
14 :param pk: key of the message
15 :return: redirect 304 to the overview of notifications
16 """
17 message = get_object_or_404(Message, pk=pk)
18 message.send()
19 return redirect("admin:pushnotifications_message_changelist")