Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added app/base/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions app/base/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BaseConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "app.base"
48 changes: 48 additions & 0 deletions app/base/blocks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from wagtail.blocks import (
CharBlock,
ChoiceBlock,
RichTextBlock,
StreamBlock,
StructBlock,
)
from wagtail.embeds.blocks import EmbedBlock
from wagtail.images.blocks import ImageBlock


class CaptionedImageBlock(StructBlock):
image = ImageBlock(required=True)
caption = CharBlock(required=False)
attribution = CharBlock(required=False)

class Meta:
icon = "image"
template = "base/blocks/captioned_image_block.html"


class HeadingBlock(StructBlock):
heading_text = CharBlock(classname="title", required=True)
size = ChoiceBlock(
choices=[
("", "Select a heading size"),
("h2", "H2"),
("h3", "H3"),
("h4", "H4"),
],
blank=True,
required=False,
)

class Meta:
icon = "title"
template = "base/blocks/heading_block.html"


class BaseStreamBlock(StreamBlock):
heading_block = HeadingBlock()
paragraph_block = RichTextBlock(icon="pilcrow")
image_block = CaptionedImageBlock()
embed_block = EmbedBlock(
help_text="Insert a URL to embed. For example, https://www.youtube.com/watch?v=SGJFWirQ3ks",
icon="media",
template="base/blocks/embed_block.html",
)
152 changes: 152 additions & 0 deletions app/base/migrations/0001_create_footer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Generated by Django 5.1.4 on 2024-12-14 17:23

import uuid

import django.db.models.deletion
import wagtail.fields
import wagtail.models
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
("wagtailcore", "0094_alter_page_locale"),
]

operations = [
migrations.CreateModel(
name="NavigationSettings",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"linkedin_url",
models.URLField(blank=True, verbose_name="LinkedIn URL"),
),
("github_url", models.URLField(blank=True, verbose_name="GitHub URL")),
(
"mastodon_url",
models.URLField(blank=True, verbose_name="Mastodon URL"),
),
],
options={
"abstract": False,
},
),
migrations.CreateModel(
name="FooterText",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"translation_key",
models.UUIDField(default=uuid.uuid4, editable=False),
),
(
"live",
models.BooleanField(
default=True, editable=False, verbose_name="live"
),
),
(
"has_unpublished_changes",
models.BooleanField(
default=False,
editable=False,
verbose_name="has unpublished changes",
),
),
(
"first_published_at",
models.DateTimeField(
blank=True,
db_index=True,
null=True,
verbose_name="first published at",
),
),
(
"last_published_at",
models.DateTimeField(
editable=False, null=True, verbose_name="last published at"
),
),
(
"go_live_at",
models.DateTimeField(
blank=True, null=True, verbose_name="go live date/time"
),
),
(
"expire_at",
models.DateTimeField(
blank=True, null=True, verbose_name="expiry date/time"
),
),
(
"expired",
models.BooleanField(
default=False, editable=False, verbose_name="expired"
),
),
("body", wagtail.fields.RichTextField()),
(
"latest_revision",
models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailcore.revision",
verbose_name="latest revision",
),
),
(
"live_revision",
models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailcore.revision",
verbose_name="live revision",
),
),
(
"locale",
models.ForeignKey(
editable=False,
on_delete=django.db.models.deletion.PROTECT,
related_name="+",
to="wagtailcore.locale",
verbose_name="locale",
),
),
],
options={
"verbose_name_plural": "Footer Text",
"abstract": False,
"unique_together": {("translation_key", "locale")},
},
bases=(wagtail.models.PreviewableMixin, models.Model),
),
]
162 changes: 162 additions & 0 deletions app/base/migrations/0002_add_form_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Generated by Django 5.0.9 on 2024-12-14 17:50

import django.db.models.deletion
import modelcluster.fields
import wagtail.contrib.forms.models
import wagtail.fields
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("base", "0001_create_footer"),
("wagtailcore", "0094_alter_page_locale"),
]

operations = [
migrations.CreateModel(
name="FormPage",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
(
"to_address",
models.CharField(
blank=True,
help_text="Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.", # noqa: E501
max_length=255,
validators=[wagtail.contrib.forms.models.validate_to_address],
verbose_name="to address",
),
),
(
"from_address",
models.EmailField(
blank=True, max_length=255, verbose_name="from address"
),
),
(
"subject",
models.CharField(
blank=True, max_length=255, verbose_name="subject"
),
),
("intro", wagtail.fields.RichTextField(blank=True)),
("thank_you_text", wagtail.fields.RichTextField(blank=True)),
],
options={
"abstract": False,
},
bases=(
wagtail.contrib.forms.models.FormMixin,
"wagtailcore.page",
models.Model,
),
),
migrations.CreateModel(
name="FormField",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"sort_order",
models.IntegerField(blank=True, editable=False, null=True),
),
(
"clean_name",
models.CharField(
blank=True,
default="",
help_text="Safe name of the form field, the label converted to ascii_snake_case",
max_length=255,
verbose_name="name",
),
),
(
"label",
models.CharField(
help_text="The label of the form field",
max_length=255,
verbose_name="label",
),
),
(
"field_type",
models.CharField(
choices=[
("singleline", "Single line text"),
("multiline", "Multi-line text"),
("email", "Email"),
("number", "Number"),
("url", "URL"),
("checkbox", "Checkbox"),
("checkboxes", "Checkboxes"),
("dropdown", "Drop down"),
("multiselect", "Multiple select"),
("radio", "Radio buttons"),
("date", "Date"),
("datetime", "Date/time"),
("hidden", "Hidden field"),
],
max_length=16,
verbose_name="field type",
),
),
(
"required",
models.BooleanField(default=True, verbose_name="required"),
),
(
"choices",
models.TextField(
blank=True,
help_text="Comma or new line separated list of choices. Only applicable in checkboxes, radio and dropdown.", # noqa: E501
verbose_name="choices",
),
),
(
"default_value",
models.TextField(
blank=True,
help_text="Default value. Comma or new line separated values supported for checkboxes.",
verbose_name="default value",
),
),
(
"help_text",
models.CharField(
blank=True, max_length=255, verbose_name="help text"
),
),
(
"page",
modelcluster.fields.ParentalKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="form_fields",
to="base.formpage",
),
),
],
options={
"ordering": ["sort_order"],
"abstract": False,
},
),
]
Empty file added app/base/migrations/__init__.py
Empty file.
Loading