summaryrefslogtreecommitdiff
path: root/app/lttr
diff options
context:
space:
mode:
Diffstat (limited to 'app/lttr')
-rw-r--r--app/lttr/urls.py2
-rw-r--r--app/lttr/views.py9
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