summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf>2021-03-21 20:51:36 -0400
committerluxagraf <sng@luxagraf>2021-03-21 20:51:36 -0400
commit13ed0a5e81c0da5ab639a017a7d03e2bafdddeea (patch)
treea4d9986408b0b747560b87003462e5221ac00aac
parent44af81a8b1875321fb4c97c471290d6a888c1e46 (diff)
src: made signup form work
-rw-r--r--app/lttr/urls.py2
-rw-r--r--app/lttr/views.py9
-rw-r--r--app/posts/urls/src_urls.py30
-rw-r--r--config/base_urls.py3
4 files changed, 29 insertions, 15 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(),
diff --git a/config/base_urls.py b/config/base_urls.py
index e1ec3d4..19a8b43 100644
--- a/config/base_urls.py
+++ b/config/base_urls.py
@@ -59,7 +59,6 @@ urlpatterns = [
path(r'dialogues/', include('sightings.urls', namespace='sightings')),
path(r'field-notes/', include('posts.urls.field_note_urls', namespace='fieldnote')),
path(r'src/', include('posts.urls.src_urls', namespace='src')),
- #path(r'essays/', include('essays.urls', namespace='essays')),
path(r'work/', include('resume.urls', namespace='resume')),
path(r'map', include('locations.urls', namespace='map')),
path(r'map/', include('locations.urls', namespace='map')),
@@ -68,7 +67,7 @@ urlpatterns = [
path(r'<slug>/', include('lttr.urls')),
path(r'<slug>.txt', PageDetailTXTView.as_view()),
path(r'<slug>', include('pages.urls', namespace='pages')),
- path(r'<path>/<slug>/', PageDetailView.as_view()),
+ #path(r'<path>/<slug>/', PageDetailView.as_view()),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)