summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/lttr/forms.py9
-rw-r--r--app/lttr/models.py12
-rw-r--r--app/lttr/send.py6
-rw-r--r--app/lttr/urls.py5
-rw-r--r--app/lttr/views.py19
-rw-r--r--app/pages/templates/pages/luxagraf/homepage.html2
-rw-r--r--app/pages/templates/pages/luxagraf/postcards.html21
-rw-r--r--app/posts/templates/posts/friends_list.html16
8 files changed, 73 insertions, 17 deletions
diff --git a/app/lttr/forms.py b/app/lttr/forms.py
index e3fb272..5718d6e 100644
--- a/app/lttr/forms.py
+++ b/app/lttr/forms.py
@@ -2,7 +2,7 @@ from django import forms
from django.forms.utils import ValidationError
from .validators import validate_email_nouser
-from .models import Subscriber
+from .models import Subscriber, PostcardSubscriber
class SubscribeForm(forms.ModelForm):
@@ -98,3 +98,10 @@ class UpdateForm(NewsletterForm):
user_activation_code = forms.CharField(
label=("Activation code"), max_length=40
)
+
+
+class PostcardForm(forms.ModelForm):
+
+ class Meta:
+ model = PostcardSubscriber
+ fields = ['name', 'address']
diff --git a/app/lttr/models.py b/app/lttr/models.py
index 653eded..863d4e4 100644
--- a/app/lttr/models.py
+++ b/app/lttr/models.py
@@ -468,3 +468,15 @@ newsletter = Newsletter.objects.get(pk=3)
n = SendShit(newsletter, mailing, 1)
n.send_mailings()
'''
+
+
+class PostcardSubscriber(models.Model):
+ """ A model for grabbing addresses to send postcards """
+ date_created = models.DateTimeField(blank=True, auto_now_add=True, editable=False)
+ date_updated = models.DateTimeField(blank=True, auto_now=True, editable=False)
+ address = models.TextField()
+ name = models.CharField(max_length=120)
+
+ def __str__(self):
+ return self.name
+
diff --git a/app/lttr/send.py b/app/lttr/send.py
new file mode 100644
index 0000000..cd012e2
--- /dev/null
+++ b/app/lttr/send.py
@@ -0,0 +1,6 @@
+from lttr.models import Newsletter, NewsletterMailing
+from lttr.mailer import SendShit
+n = Newsletter.objects.get(pk=tk)
+m = NewsletterMailing.objects.get(pk=tk)
+s = SendShit(n, m)
+s.send_mailings()
diff --git a/app/lttr/urls.py b/app/lttr/urls.py
index abeac11..d790f0f 100644
--- a/app/lttr/urls.py
+++ b/app/lttr/urls.py
@@ -6,6 +6,11 @@ app_name = "lttr"
urlpatterns = [
path(
+ 'postcardsubscribe',
+ views.PostcardSubscribeView.as_view(),
+ name='postcard_subscribe'
+ ),
+ path(
'<str:slug>/unsubscribe/<str:activation_code>',
views.UnsubscribeRequestView.as_view(),
name='newsletter_unsubscribe'
diff --git a/app/lttr/views.py b/app/lttr/views.py
index 3980fd4..c4414b2 100644
--- a/app/lttr/views.py
+++ b/app/lttr/views.py
@@ -13,8 +13,8 @@ from django.urls import reverse, reverse_lazy
from utils.views import PaginatedListView, LuxDetailView
from smtplib import SMTPException
-from .models import OldNewsletterMailing, Subscriber, Newsletter
-from .forms import SubscribeRequestForm, UpdateForm
+from .models import OldNewsletterMailing, Subscriber, Newsletter, PostcardSubscriber
+from .forms import SubscribeRequestForm, UpdateForm, PostcardForm
ACTIONS = ('subscribe', 'unsubscribe', 'update')
@@ -104,3 +104,18 @@ class UnsubscribeRequestView(DetailView):
context['subscriber'] = self.get_object()
context['newsletter'] = self.kwargs['slug']
return context
+
+class PostcardSubscribeView(CreateView):
+ """
+ Return a subscribe form for iframe embedding
+ """
+ model = PostcardSubscriber
+ form_class = PostcardForm
+
+
+ def get_template_names(self):
+ return ["lttr/%s_subscribe.html" % self.slug, 'lttr/subscribe.html']
+
+ def get_success_url(self):
+ return reverse_lazy('card:subscribed')
+
diff --git a/app/pages/templates/pages/luxagraf/homepage.html b/app/pages/templates/pages/luxagraf/homepage.html
index fa322c9..b7fa7d4 100644
--- a/app/pages/templates/pages/luxagraf/homepage.html
+++ b/app/pages/templates/pages/luxagraf/homepage.html
@@ -47,7 +47,7 @@
<img src="/media/img/usa-resize.svg" alt="map of travels" class="homepage-map-img" />
<div>
<p>We’re a family of five living full time in a vintage 1969 Dodge Travco motorhome. We’ve been at it for three years now. People always ask: <a href="https://luxagraf.net/1969-dodge-travco-motorhome">What's it like for five people to live in a 26ft RV</a>? <a href="https://luxagraf.net/essay/why-a-vintage-rv">Why do we live this way</a>?</p>
- <p>The short answer is simple: because we like it and we can. If you want more than a soundbite, <a href="/jrnl/">read through the journal</a>. If you like it, sign up for the newsletter, <a href="/friends/"><em>Friends of a Long Year</em></a>. I'd also <a href="/feed.xml">subscribe to the RSS feed</a>, but that's just <a href="/about">me</a>. <!-- If you’re interested there’s a guide section with some <a href="/guides/">advice, tips and tricks for those who’d aspire to live full time in a van or RV</a> --></p>
+ <p>If you're curious, <a href="/jrnl/">read through the journal</a>. If you like it, sign up for the private mailing list, <a href="/friends/"><em>Friends of a Long Year</em></a>. You can also sign up to <a href="/cards">get a postcard</a> from us on the road. Yes. Seriously. Or you might prefer to <a href="/feed.xml">subscribe to the RSS feed</a>. <!-- If you’re interested there’s a guide section with some <a href="/guides/">advice, tips and tricks for those who’d aspire to live full time in a van or RV</a> --></p>
</div>
</div>
</section>
diff --git a/app/pages/templates/pages/luxagraf/postcards.html b/app/pages/templates/pages/luxagraf/postcards.html
new file mode 100644
index 0000000..5f9c19c
--- /dev/null
+++ b/app/pages/templates/pages/luxagraf/postcards.html
@@ -0,0 +1,21 @@
+{% extends 'base.html' %}
+{% load typogrify_tags %}
+{% load comments %}
+{% block pagetitle %}Luxagraf | {{object.title}}{% endblock %}
+{% block metadescription %}{{object.meta_description}}{% endblock %}
+{%block htmlclass%}class="detail"{%endblock%}
+{%block bodyid%}id="{{object.title|slugify}}"{%endblock%}
+{% block breadcrumbs %}{% include "lib/breadcrumbs.html" with breadcrumbs=breadcrumbs %}{% endblock %}
+{% block primary %}<main>
+ <article class="content">
+ <header class="post-header">
+ <h1 class="post-title">{{object.title}}</h1>
+ {%if object.sub_title %}<h2 class="post-subtitle">{{object.sub_title}}</h2>{%endif%}
+ </header>
+ <div class="post-article">
+ {{object.body_html|safe|smartypants|widont}}
+ <iframe target='_parent' style="border:none !important; background:white; width:100% !important;" title="embedded form for subscribing the the Friends of a Long Year newsletter" src="{% url 'lttr:postcardsubscribe' %}"></iframe>
+ </div>
+ </article>
+ </main>
+{% endblock %}
diff --git a/app/posts/templates/posts/friends_list.html b/app/posts/templates/posts/friends_list.html
index b77f345..799fcf3 100644
--- a/app/posts/templates/posts/friends_list.html
+++ b/app/posts/templates/posts/friends_list.html
@@ -7,22 +7,12 @@
{% block primary %}
<main role="main" class="archive-wrapper">
<div class="archive-intro">
- <h1 class="list-hed">Join the <em>Friends of a Long Year</em>.</h1>
+ <h1 class="list-hed"><em>Psst</em>, Wanna Join the <em>Friends of a Long Year</em>?</h1>
<iframe target='_parent' style="border:none; background:white; width:100%;" title="embedded form for subscribing the the Friends of a Long Year newsletter" src="{% url 'lttr:subscribe' slug='friends' %}"></iframe>
<h2 class="list-subhed">Say what? </h2>
- <p><em>Friends of a Long Year</em> is a monthly letter about living outdoors, travel, literature, music, vintage vehicles, and other ephemera. It's written in the spirit of Mary Austin. And Mike’s emails. A more detailed explaination can be found <a href="/jrnl/2020/11/invitation">here</a>.</p>
+ <p><em>Friends of a Long Year</em> is a private mailing list that delivers <a href="/jrnl/">journal posts</a> from this site to your inbox like it's still 1995. It's written in the spirit of Mary Austin. And Mike’s emails. A more detailed explaination can be found <a href="/jrnl/2020/11/invitation">here</a>.</p>
+ <p>If you really want to go nuts and experience the world of like, 1986, you can <a href="/card/">sign up here to get a postcard</a> from us on the road. Yes. Seriously.</p>
<p>Unsubscribing is easy. It's all <a href="/src/building-your-own-mailing-list-software">self-hosted</a> and designed to <a href="/privacy" title="My privacy policy">respect your privacy</a>.</p>
</div>
- <h3 class="archive-sans">Letters</h3>
- <ul class="archive-list">{% for object in object_list %}
- <li class="h-entry hentry archive-list-card" itemscope itemType="http://schema.org/Article">
- <a href="{{object.get_absolute_url}}" class="u-url">
- {% if object.featured_image %}<div class="circle-img-wrapper"><img src="{{object.featured_image.get_thumbnail_url}}" alt="{{object.featured_image.alt}}" class="u-photo" /></div>{%endif%}
- <span class="date dt-published card-smcaps">issue {{object.get_issue_str}} &ndash; {{object.pub_date|date:"M y"}}</span>
- <h2 class="card-hed">{{object.title|safe|smartypants|widont}}</h2>
- {% if object.subtitle %}<h3 class="p-summary card-lede">{{object.subtitle|safe|smartypants|widont}}</h3>{%endif%}
- </a>
- </li>
- {%endfor%}</ul>
</main>
{%endblock%}