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 | |
parent | 44af81a8b1875321fb4c97c471290d6a888c1e46 (diff) |
src: made signup form work
Diffstat (limited to 'app')
-rw-r--r-- | app/lttr/urls.py | 2 | ||||
-rw-r--r-- | app/lttr/views.py | 9 | ||||
-rw-r--r-- | app/posts/urls/src_urls.py | 30 |
3 files changed, 28 insertions, 13 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 diff --git a/app/posts/urls/src_urls.py b/app/posts/urls/src_urls.py index 637d9a6..b98121b 100644 --- a/app/posts/urls/src_urls.py +++ b/app/posts/urls/src_urls.py @@ -1,6 +1,7 @@ from django.urls import path, re_path from ..views import src_views as views +from lttr import views as lttrviews app_name = "src" @@ -15,16 +16,25 @@ urlpatterns = [ views.TopicListView.as_view(), name="list_topics" ), - #path( - # r'books/<str:slug>', - # views.BookDetailView.as_view(), - # name='detail_book' - #), - #path( - # r'books/', - # views.BookListView.as_view(), - # name='list_books' - #), + path( + 'unsubscribe/<str:activation_code>', + lttrviews.UnsubscribeRequestView.as_view(), + name='newsletter_unsubscribe' + ), + path( + r'subscribe/', + lttrviews.NewsletterSubscribeView.as_view(slug='src'), + name="subscribe" + ), + path( + 'activate/<str:activation_code>/', + lttrviews.ConfirmSubscriptionView.as_view(), name='newsletter_activate' + ), + path( + r'subscribed/', + lttrviews.NewsletterSubscribedView.as_view(), + name="subscribed" + ), path( r'<str:slug>.txt', views.SrcDetailViewTXT.as_view(), |