Compare commits

..

10 commits

25 changed files with 202 additions and 817 deletions

View file

@ -1,3 +1,4 @@
.idea/
# Django project
/media/
/static/

View file

@ -15,8 +15,9 @@
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/env" />
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Python 3.13 (iamkonstantin-web)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">

2
.idea/misc.xml generated
View file

@ -3,5 +3,5 @@
<component name="Black">
<option name="sdkName" value="Python 3.12 (iamkonstantin-web)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (iamkonstantin-web)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (iamkonstantin-web)" project-jdk-type="Python SDK" />
</project>

View file

@ -1,5 +1,5 @@
# Use an official Python runtime based on Debian 10 "buster" as a parent image.
FROM python:3.11-slim-buster
FROM python:3.13-slim
# Add user that will be used in the container.
# RUN useradd wagtail
@ -15,10 +15,10 @@ ENV PYTHONUNBUFFERED=1 \
PORT=8000
# Install system packages required by Wagtail and Django.
RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \
build-essential \
libpq-dev \
libmariadbclient-dev \
RUN apt-get update --yes --quiet && apt-get install --yes --no-install-recommends \
# build-essential \
# libpq-dev \
# libmariadbclient-dev \
libjpeg62-turbo-dev \
zlib1g-dev \
libwebp-dev \

View file

@ -1,5 +1,5 @@
.PHONY: help build publish
VERSION = 1.2.2
VERSION = 1.5.0
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}'
@ -8,7 +8,8 @@ build:
@docker build -t code.headbright.be/konstantin/iamkonstantin:$(VERSION) .
publish:
@docker push code.headbright.be/konstantin/iamkonstantin:$(VERSION)
# something to try: --provenance=false
@docker buildx build -t code.headbright.be/konstantin/iamkonstantin:$(VERSION) --platform linux/arm64 --push .
bump:
@bash ./bump_version.sh
upgrade: build publish

View file

@ -0,0 +1,23 @@
# Generated by Django 5.0.2 on 2024-10-06 15:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0006_navigationsettings_bluesky_url_and_more'),
]
operations = [
migrations.RemoveField(
model_name='formpage',
name='page_ptr',
),
migrations.DeleteModel(
name='FormField',
),
migrations.DeleteModel(
name='FormPage',
),
]

View file

@ -76,25 +76,25 @@ class FooterText(
class Meta(TranslatableMixin.Meta):
verbose_name_plural = "Footer Text"
class FormField(AbstractFormField):
page = ParentalKey('FormPage', on_delete=models.CASCADE, related_name='form_fields')
class FormPage(AbstractEmailForm):
intro = RichTextField(blank=True)
thank_you_text = RichTextField(blank=True)
content_panels = AbstractEmailForm.content_panels + [
FormSubmissionsPanel(),
FieldPanel('intro'),
InlinePanel('form_fields', label="Form fields"),
FieldPanel('thank_you_text'),
MultiFieldPanel([
FieldRowPanel([
FieldPanel('from_address'),
FieldPanel('to_address'),
]),
FieldPanel('subject'),
], "Email"),
]
#
# class FormField(AbstractFormField):
# page = ParentalKey('FormPage', on_delete=models.CASCADE, related_name='form_fields')
#
#
# class FormPage(AbstractEmailForm):
# intro = RichTextField(blank=True)
# thank_you_text = RichTextField(blank=True)
#
# content_panels = AbstractEmailForm.content_panels + [
# FormSubmissionsPanel(),
# FieldPanel('intro'),
# InlinePanel('form_fields', label="Form fields"),
# FieldPanel('thank_you_text'),
# MultiFieldPanel([
# FieldRowPanel([
# FieldPanel('from_address'),
# FieldPanel('to_address'),
# ]),
# FieldPanel('subject'),
# ], "Email"),
# ]

View file

@ -15,55 +15,54 @@
<div class="mt-16 space-y-20 lg:mt-20 blog-pages">
{% for post in blogpages %}
{% with post=post.specific %}
<div class="relative isolate flex flex-col gap-8">
<div class="group relative w-full">
<h2 class="mt-3 font-semibold leading-6 group-hover:text-klavender border-klavender border-b-4">
<a href="{% pageurl post %}">
<span class="absolute inset-0"></span>
{{ post.title }}
</a>
</h2>
<p class="mt-5 leading-6">{{ post.intro }}</p>
</div>
{% if post.main_image %}
<div class="relative mx-auto">
{% with post.main_image as main_image %}
{% if main_image %}
{% image main_image width-1600 class="blog" %}{% endif %}
<article class="relative isolate flex flex-col gap-8">
<div class="group relative w-full">
<h2 class="mt-3 font-semibold leading-6 group-hover:text-klavender border-klavender border-b-4">
<a href="{% pageurl post %}">
<span class="absolute inset-0"></span>
{{ post.title }}
</a>
</h2>
<p class="mt-5 leading-6">{{ post.intro }}</p>
</div>
{% if post.main_image %}
<div class="relative mx-auto">
{% with post.main_image as main_image %}
{% if main_image %}
{% image main_image width-1600 class="blog" %}{% endif %}
{% endwith %}
<div class="absolute inset-0 rounded-2xl ring-1 ring-inset ring-gray-900/10"></div>
</div>
{% endif %}
<div class="flex-col items-center text-xs">
<div class="space-x-2 text-left"><span class="emoji"
aria-hidden="true">🕘</span>
<time class="text-sm"
datetime="{{ post.date|date:"Y-m-d" }}">{{ post.date }}</time>
</div>
{% with tags=post.tags.all %}
{% if tags %}
<div class="tags mt-2">
<h3 class="sr-only">Tags</h3>
<ul class="flex">
{% for tag in tags %}
<li class="lg:space-x-2"><span class="emoji">🏷️</span>
<a class="pr-2"
href="{% slugurl 'tags' %}?tag={{ tag }}">{{ tag }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endwith %}
<div class="absolute inset-0 rounded-2xl ring-1 ring-inset ring-gray-900/10"></div>
</div>
{% endif %}
<div class="flex-col items-center text-xs">
<div class="space-x-2 text-left"><span class="emoji"
aria-hidden="true">🕘</span>
<time class="text-sm"
datetime="{{ post.date|date:"Y-m-d" }}">{{ post.date }}</time>
</div>
{% with tags=post.tags.all %}
{% if tags %}
<div class="tags mt-2">
<h3 class="sr-only">Tags</h3>
<ul class="flex">
{% for tag in tags %}
<li class="lg:space-x-2"><span class="emoji">🏷️</span>
<a class="pr-2"
href="{% slugurl 'tags' %}?tag={{ tag }}">{{ tag }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endwith %}
</div>
</article>
{% endwith %}
{% endfor %}
</div>
</div>
</div>
</div>
</section>
{% endblock %}

View file

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

View file

@ -4,6 +4,8 @@ from wagtail.models import Page
from wagtail.fields import RichTextField, StreamField
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
from wagtailseo.models import SeoMixin, SeoType
from blog.models import BlogPage
from .blocks import HomeContentBlock
@ -57,3 +59,10 @@ class HomePage(SeoMixin, Page):
promote_panels = SeoMixin.seo_panels
seo_content_type = SeoType.WEBSITE
def get_context(self, request, *args, **kwargs):
context = super().get_context(request)
# retrieve the last 3 blogposts
recent_blog_items = BlogPage.objects.live().order_by('-first_published_at')[:3]
context['recent_blog_items'] = recent_blog_items
return context

File diff suppressed because one or more lines are too long

View file

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

View file

@ -4,7 +4,7 @@
<html lang="en" class="h-full antialiased">
<head>
<meta charset="utf-8"/>
<meta name="fediverse:creator" content="@konstantin@social.headbright.eu" />
<meta name="fediverse:creator" content="@konstantin@toot.iamkonstantin.eu" />
{% include "wagtailseo/meta.html" %}
<title>
{% block title %}
@ -64,7 +64,7 @@
<div class="relative w-full sm:px-8">
{% include "includes/header.html" %}
<main id="main" class="mx-auto max-w-7xl px-0 md:px-4 lg:px-8">
<main id="main" class="mx-auto max-w-5xl px-0 md:px-4 lg:px-8">
{% block content %}{% endblock %}
</main>

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",
)

View file

@ -1,5 +1,5 @@
Django>=4.2,<5.1
wagtail>=6.2.2,<6.3
Django>=4.2,<5.2
wagtail>=6.3,<6.4
whitenoise>=6.6,<7.0
wagtailcodeblock>=1.29.0.2,<2.0
django-tailwind>=3.6.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB