diff options
author | luxagraf <sng@luxagraf> | 2021-03-21 20:51:36 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf> | 2021-03-21 20:51:36 -0400 |
commit | 13ed0a5e81c0da5ab639a017a7d03e2bafdddeea (patch) | |
tree | a4d9986408b0b747560b87003462e5221ac00aac /app/lttr | |
parent | 44af81a8b1875321fb4c97c471290d6a888c1e46 (diff) |
src: made signup form work
Diffstat (limited to 'app/lttr')
-rw-r--r-- | app/lttr/urls.py | 2 | ||||
-rw-r--r-- | app/lttr/views.py | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/app/lttr/urls.py b/app/lttr/urls.py index b470431..b4485d2 100644 --- a/app/lttr/urls.py +++ b/app/lttr/urls.py @@ -21,7 +21,7 @@ urlpatterns = [ name="detail" ), path( - r'subscribe', + r'subscribe/', views.NewsletterSubscribeView.as_view(), name="subscribe" ), diff --git a/app/lttr/views.py b/app/lttr/views.py index 9682528..f5cd28a 100644 --- a/app/lttr/views.py +++ b/app/lttr/views.py @@ -83,14 +83,19 @@ class NewsletterSubscribeView(CreateView): model = Subscriber form_class = SubscribeRequestForm action = 'subscribe' + slug = None def get_template_names(self): - return ["lttr/%s_subscribe.html" % self.kwargs['slug'], 'lttr/subscribe.html'] + return ["lttr/%s_subscribe.html" % self.slug, 'lttr/subscribe.html'] def get_form_kwargs(self): kwargs = super(NewsletterSubscribeView, self).get_form_kwargs() - nl = Newsletter.objects.get(slug=self.kwargs['slug']) + try: + self.slug = self.kwargs['slug'] + except: + pass + nl = Newsletter.objects.get(slug=self.slug) kwargs['newsletter'] = nl return kwargs |