-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add the Contact Details snippet https://jira.ons.gov.uk/browse/CMS-80 * Add a basic table block * Add the release calendar app with models * Programmatically create the release calendar index * Add the basic templates * Add a base form class for easier validation * Add icons to the various panels * Add validation logic * Update templates * Add tests * Expand core tests * Expand coverage configuration adds a few extra files to the ignore. and explicitly filters the RemovedInDjango60Warning * Tidy up based on code review * Prevent release calendar page deletion through the UI * Move the changes to the release date below contact details e.g. https://www.ons.gov.uk/releases/disabilitypaygapsintheuk2014to2023 * Fail if under 90% test coverage
- Loading branch information
Showing
52 changed files
with
2,143 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
from .embeddable import DocumentBlock, DocumentsBlock, ImageBlock, ONSEmbedBlock | ||
from .markup import HeadingBlock, QuoteBlock | ||
from .markup import BasicTableBlock, HeadingBlock, QuoteBlock | ||
from .panels import PanelBlock | ||
from .related import RelatedContentBlock, RelatedLinksBlock | ||
from .related import LinkBlock, RelatedContentBlock, RelatedLinksBlock | ||
|
||
__all__ = [ | ||
"BasicTableBlock", | ||
"DocumentBlock", | ||
"DocumentsBlock", | ||
"HeadingBlock", | ||
"ImageBlock", | ||
"LinkBlock", | ||
"ONSEmbedBlock", | ||
"PanelBlock", | ||
"QuoteBlock", | ||
"RelatedContentBlock", | ||
"RelatedLinksBlock", | ||
"DocumentsBlock", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 5.1.2 on 2024-10-28 16:51 | ||
|
||
import wagtail.search.index | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ContactDetails", | ||
fields=[ | ||
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False)), | ||
("name", models.CharField(max_length=255)), | ||
("email", models.EmailField(max_length=254)), | ||
("phone", models.CharField(blank=True, max_length=255)), | ||
], | ||
options={ | ||
"verbose_name_plural": "contact details", | ||
}, | ||
bases=(wagtail.search.index.Indexed, models.Model), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from typing import ClassVar | ||
|
||
from django.db import models | ||
from wagtail.admin.panels import FieldPanel | ||
from wagtail.search import index | ||
from wagtail.snippets.models import register_snippet | ||
|
||
|
||
@register_snippet | ||
class ContactDetails(index.Indexed, models.Model): | ||
"""A model for contact details.""" | ||
|
||
name = models.CharField(max_length=255) | ||
email = models.EmailField() | ||
phone = models.CharField(max_length=255, blank=True) | ||
|
||
panels: ClassVar[list[FieldPanel]] = [ | ||
FieldPanel("name"), | ||
FieldPanel("email"), | ||
FieldPanel("phone"), | ||
] | ||
|
||
search_fields: ClassVar[list[index.SearchField | index.AutocompleteField]] = [ | ||
*index.Indexed.search_fields, | ||
index.SearchField("name"), | ||
index.AutocompleteField("name"), | ||
index.SearchField("email"), | ||
index.SearchField("phone"), | ||
] | ||
|
||
class Meta: | ||
verbose_name_plural = "contact details" | ||
|
||
def __str__(self) -> str: | ||
return str(self.name) |
Oops, something went wrong.