1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
4 from django.contrib.auth.decorators import permission_required
5 from django.http.response import HttpResponseRedirect
6 from django.shortcuts import render
7 from django.urls import reverse
9 from push.forms import NotificationForm
12 @permission_required('push.change_notification')
13 def notification_form(request):
14 if request.method == 'POST':
15 form = NotificationForm(data=request.POST, files=request.FILES or None)
18 return HttpResponseRedirect(reverse('notification_sent'))
20 form = NotificationForm()
21 return render(request, 'push/notification_form.html', {'form': form})
24 def notification_sent(request):
25 return render(request, 'push/notification_sent.html')