diff options
author | lxf <sng@luxagraf.net> | 2021-10-28 20:50:06 -0400 |
---|---|---|
committer | lxf <sng@luxagraf.net> | 2021-10-28 20:50:06 -0400 |
commit | 774a6634865a67238837d1edde3a437d0dde8e16 (patch) | |
tree | 25a7cdbd368678abf6c869b76bddb4c81bd4d203 /app/lttr/views.py | |
parent | 4bff8bb3ba33dc0164a097c6dd06aa81dc59986b (diff) |
lttr: added a form for people to get postcards
Diffstat (limited to 'app/lttr/views.py')
-rw-r--r-- | app/lttr/views.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/lttr/views.py b/app/lttr/views.py index 3980fd4..c4414b2 100644 --- a/app/lttr/views.py +++ b/app/lttr/views.py @@ -13,8 +13,8 @@ from django.urls import reverse, reverse_lazy from utils.views import PaginatedListView, LuxDetailView from smtplib import SMTPException -from .models import OldNewsletterMailing, Subscriber, Newsletter -from .forms import SubscribeRequestForm, UpdateForm +from .models import OldNewsletterMailing, Subscriber, Newsletter, PostcardSubscriber +from .forms import SubscribeRequestForm, UpdateForm, PostcardForm ACTIONS = ('subscribe', 'unsubscribe', 'update') @@ -104,3 +104,18 @@ class UnsubscribeRequestView(DetailView): context['subscriber'] = self.get_object() context['newsletter'] = self.kwargs['slug'] return context + +class PostcardSubscribeView(CreateView): + """ + Return a subscribe form for iframe embedding + """ + model = PostcardSubscriber + form_class = PostcardForm + + + def get_template_names(self): + return ["lttr/%s_subscribe.html" % self.slug, 'lttr/subscribe.html'] + + def get_success_url(self): + return reverse_lazy('card:subscribed') + |