From d4b9ac9de532cd8a139e7cab22d6137de4ccae7d Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sat, 30 Jan 2021 09:45:14 -0500 Subject: lttr: Cleaned up template code and fixed some bugs with multiple newsletter subscriptions. --- app/lttr/admin.py | 2 +- app/lttr/forms.py | 2 +- app/lttr/templates/lttr/confirm_activate.html | 23 +++++++++++++++-------- app/lttr/templates/lttr/friends_subscribe.html | 23 ----------------------- app/lttr/templates/lttr/message/subscribe.txt | 3 +-- app/lttr/templates/lttr/subscribe.html | 23 +++++++++++++++++++++++ app/lttr/templates/lttr/subscribed.html | 23 +++++++++++++++-------- app/lttr/validators.py | 15 ++++++++------- app/lttr/views.py | 2 +- 9 files changed, 65 insertions(+), 51 deletions(-) delete mode 100644 app/lttr/templates/lttr/friends_subscribe.html create mode 100644 app/lttr/templates/lttr/subscribe.html diff --git a/app/lttr/admin.py b/app/lttr/admin.py index b406613..b4c223a 100644 --- a/app/lttr/admin.py +++ b/app/lttr/admin.py @@ -6,7 +6,7 @@ from .models import NewsletterMailing, Subscriber, Newsletter, MailingStatus @admin.register(Subscriber) class SubscriberAdmin(admin.ModelAdmin): - list_display = ('email_field', 'user', 'date_created', 'subscribed', 'subscribe_date', 'unsubscribed') + list_display = ('email_field', 'user', 'newsletter', 'date_created', 'subscribed', 'subscribe_date', 'unsubscribed') search_fields = ['email_field'] list_filter = ['unsubscribed'] diff --git a/app/lttr/forms.py b/app/lttr/forms.py index ad41d66..e3fb272 100644 --- a/app/lttr/forms.py +++ b/app/lttr/forms.py @@ -62,7 +62,7 @@ class SubscribeRequestForm(NewsletterForm): if subscription.subscribed and not subscription.unsubscribed: raise ValidationError( - "Your e-mail address has already been subscribed to." + "I appreciate the effort, but you're already subscribed. (if you're not receiving newsletters, email me at sng@luxagraf.net and I will see what's going on)" ) else: self.instance = subscription diff --git a/app/lttr/templates/lttr/confirm_activate.html b/app/lttr/templates/lttr/confirm_activate.html index b283adb..533d93f 100644 --- a/app/lttr/templates/lttr/confirm_activate.html +++ b/app/lttr/templates/lttr/confirm_activate.html @@ -1,15 +1,22 @@ {% extends 'base.html' %} {% load typogrify_tags %} -{% block pagetitle %}Luxagraf | Friends of a Long Year {% endblock %} -{% block metadescription %}An infrequesnt mailing list about travel, photography, tools, walking, the natural world and other ephemera.{% endblock %} +{% block pagetitle %}Your subscription is active, thank you! | luxagraf.net {% endblock %} +{% block metadescription %}Thank you, I appreciate you joining the club{% endblock %} -{% block primary %} -
-
+{% block primary %} + +
+

You're confirmed, thanks for joining.

If you'd like you can visit the archives of past mailings.

diff --git a/app/lttr/templates/lttr/friends_subscribe.html b/app/lttr/templates/lttr/friends_subscribe.html deleted file mode 100644 index e73ca73..0000000 --- a/app/lttr/templates/lttr/friends_subscribe.html +++ /dev/null @@ -1,23 +0,0 @@ -{% load typogrify_tags %} - - - - - - - - - - {% if field.errors %}{{field.errors}}{% endif %} - {%endfor%} - - diff --git a/app/lttr/templates/lttr/message/subscribe.txt b/app/lttr/templates/lttr/message/subscribe.txt index 2af5378..6869d5f 100644 --- a/app/lttr/templates/lttr/message/subscribe.txt +++ b/app/lttr/templates/lttr/message/subscribe.txt @@ -5,5 +5,4 @@ Someone, hopefully you, asked to subscribe to {{ newsletter.title }}, a luxagraf If you would like to confirm your subscription, please follow this activation link: https://{{ site.domain }}{{ subscription.subscribe_activate_url }} -cheers -Scott +-Scott diff --git a/app/lttr/templates/lttr/subscribe.html b/app/lttr/templates/lttr/subscribe.html new file mode 100644 index 0000000..e73ca73 --- /dev/null +++ b/app/lttr/templates/lttr/subscribe.html @@ -0,0 +1,23 @@ +{% load typogrify_tags %} + + + + + + + + + + {% if field.errors %}{{field.errors}}{% endif %} + {%endfor%} + + diff --git a/app/lttr/templates/lttr/subscribed.html b/app/lttr/templates/lttr/subscribed.html index 18ad151..7139d24 100644 --- a/app/lttr/templates/lttr/subscribed.html +++ b/app/lttr/templates/lttr/subscribed.html @@ -1,15 +1,22 @@ {% extends 'base.html' %} {% load typogrify_tags %} -{% block pagetitle %}Luxagraf | Friends of a Long Year {% endblock %} -{% block metadescription %}An infrequesnt mailing list about travel, photography, tools, walking, the natural world and other ephemera.{% endblock %} +{% block pagetitle %}Thanks for subscribing! | luxagraf.net {% endblock %} +{% block metadescription %}Thank you, I appreciate you joining the club{% endblock %} -{% block primary %} -
-
+{% block primary %} + +
+

Thanks for joining.

Check your email for a link to confirm your subscription

diff --git a/app/lttr/validators.py b/app/lttr/validators.py index 754df3b..a6355bf 100644 --- a/app/lttr/validators.py +++ b/app/lttr/validators.py @@ -8,11 +8,12 @@ def validate_email_nouser(email): Check if the email address does not belong to an existing user. """ # Check whether we should be subscribed to as a user - User = get_user_model() + #User = get_user_model() - if User.objects.filter(email__exact=email).exists(): - raise ValidationError(_( - "The e-mail address '%(email)s' belongs to a user with an " - "account on this site. Please log in as that user " - "and try again." - ) % {'email': email}) + #if User.objects.filter(email__exact=email).exists(): + # raise ValidationError(_( + # "The e-mail address '%(email)s' belongs to a user with an " + # "account on this site. Please log in as that user " + # "and try again." + # ) % {'email': email}) + pass diff --git a/app/lttr/views.py b/app/lttr/views.py index 9b739a1..7a8b596 100644 --- a/app/lttr/views.py +++ b/app/lttr/views.py @@ -86,7 +86,7 @@ class NewsletterSubscribeView(CreateView): def get_template_names(self): - return "lttr/%s_subscribe.html" % self.kwargs['slug'] + return ["lttr/%s_subscribe.html" % self.kwargs['slug'], 'lttr/subscribe.html'] def get_form_kwargs(self): kwargs = super(NewsletterSubscribeView, self).get_form_kwargs() -- cgit v1.2.3-70-g09d2