feat: add newsletter with mailjet

This commit is contained in:
Konstantin 2024-10-07 09:26:43 +02:00
parent ce02ef9741
commit 483b9f3ba0
14 changed files with 53 additions and 2 deletions

View file

@ -1,5 +1,5 @@
.PHONY: help build publish
VERSION = 1.2.2
VERSION = 1.2.3
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

View file

@ -80,4 +80,7 @@
</section>
<section>
{% include 'newsletter/snippets/signup_form.html' %}
</section>
{% endblock %}

View file

@ -781,4 +781,7 @@
</div>
</section>
<section>
{% include 'newsletter/snippets/signup_form.html' %}
</section>
{% endblock content %}

View file

@ -29,6 +29,7 @@ INSTALLED_APPS = [
"blog",
"home",
"search",
"newsletter",
"wagtailcodeblock",
"wagtailseo",
"wagtail.contrib.settings",

View file

@ -8,6 +8,7 @@ from wagtail import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls
from blog.feeds import RssBlogFeed
from newsletter import views as newsletter_views
from search import views as search_views
from wagtail.contrib.sitemaps.views import sitemap
from base.views import KeyView
@ -20,7 +21,8 @@ urlpatterns = [
path("blog/feed/", RssBlogFeed(), name="blog_feed"),
path('sitemap.xml', sitemap),
path('robots.txt', TemplateView.as_view(template_name="robots.txt", content_type="text/plain")),
path('<str:key>.txt', KeyView.as_view())
path('<str:key>.txt', KeyView.as_view()),
path('newsletter/thanks', newsletter_views.thanks, name='thanks')
]
if settings.DEBUG:

0
newsletter/__init__.py Normal file
View file

3
newsletter/admin.py Normal file
View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
newsletter/apps.py Normal file
View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class NewsletterConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'newsletter'

View file

3
newsletter/models.py Normal file
View file

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View file

@ -0,0 +1,4 @@
<div class="py-16 sm:py-24 lg:py-32">
<iframe data-w-type="embedded" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://sgx7y.mjt.lu/wgt/sgx7y/xtn1/form?c=c9b8015e" width="100%" style="height: 0;"></iframe>
<script type="text/javascript" src="https://app.mailjet.com/pas-nc-embedded-v1.js"></script>
</div>

View file

@ -0,0 +1,15 @@
{% extends "base.html" %}
{% load static wagtailcore_tags %}
{% block title %}Newsletter{% endblock %}
{% block content %}
<div class="min-h-96 flex flex-col">
<section class="flex-grow h-full px-0 md:px-4 lg:px-8">
<div class="px-0 md:px-4 lg:px-8">
<h1>Thank you</h1>
Your newsletter subscription is confirmed.
</div>
</section>
</div>
{% endblock %}

3
newsletter/tests.py Normal file
View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

8
newsletter/views.py Normal file
View file

@ -0,0 +1,8 @@
from django.template.response import TemplateResponse
def thanks(request):
return TemplateResponse(
request,
"newsletter/thanks.html",
)