1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django.http.response import HttpResponseRedirect
5 from django.shortcuts import render, get_object_or_404
6 from django.urls import reverse
7 from django.utils.translation import gettext_lazy as _
9 from newsletter.forms import SubscribeForm, Newsletter
12 def subscribe_form(request, slug=''):
13 newsletter = get_object_or_404(Newsletter, slug=slug)
15 form = SubscribeForm(newsletter, request.POST)
18 return HttpResponseRedirect(reverse('subscribed'))
20 form = SubscribeForm(newsletter)
22 template_name = 'newsletter/2022/subscribe_form.html'
23 return render(request, template_name, {
24 'page_title': newsletter.page_title,
29 def subscribed(request):
30 template_name = 'newsletter/2022/subscribed.html'
31 return render(request, template_name, {
32 'page_title': _('Subscribed'),