-
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.
* Standard_pages app creation * Django models for information page updated and the template for the information page tweaked * Replace `pytest` with Django's built-in runner (#18) * Release calendar pages (#16) * Replace Docker Desktop setup with Colima (#24) * Add Cookie banner and Google Tag Manager snippet (#19) * Analysis page and series (#20) * Addition of equation partials * Repeated code remove, /media added to .gitignore, media file removed * Related pages InlinePanel added. Add Info Template updated. --------- Co-authored-by: Neha <[email protected]> Co-authored-by: Sanjeev <[email protected]>
- Loading branch information
1 parent
ac4b8af
commit 0fee2f4
Showing
9 changed files
with
159 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,3 +187,6 @@ static/ | |
|
||
# mkdocs | ||
/site | ||
|
||
# Media files | ||
/media |
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,27 @@ | ||
{% extends "templates/base_page.html" %} | ||
{% from "components/related-content/_macro.njk" import onsRelatedContent %} | ||
|
||
{% block main %} | ||
<p>{{ page.summary }}</p> | ||
|
||
{% if page.last_updated %} | ||
<h5>Last Updated: {{ page.last_updated }}</h5> | ||
{% endif %} | ||
|
||
{% include_block page.content %} | ||
|
||
{% if page.related_pages %} | ||
{# fmt:off #} | ||
{{- | ||
onsRelatedContent({ | ||
"ariaLabel": _('Related content'), | ||
"rows": [{ | ||
"id": 'related-content', | ||
"title": _('Related content'), | ||
"itemsList": page.related_pages | ||
}] | ||
}) | ||
-}} | ||
{# fmt:on #} | ||
{% endif %} | ||
{% endblock %} |
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
Empty file.
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,8 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class StandardPagesConfig(AppConfig): | ||
"""The standard_pages app config.""" | ||
|
||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "cms.standard_pages" |
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,64 @@ | ||
# Generated by Django 5.1.2 on 2024-11-08 15:48 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
import cms.core.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [ | ||
("images", "0001_initial"), | ||
("wagtailcore", "0094_alter_page_locale"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="InformationPage", | ||
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", | ||
), | ||
), | ||
("listing_title", models.CharField(blank=True, max_length=255)), | ||
("listing_summary", models.CharField(blank=True, max_length=255)), | ||
("social_text", models.CharField(blank=True, max_length=255)), | ||
("summary", models.TextField(max_length=255)), | ||
("last_updated", models.DateField(blank=True, null=True)), | ||
("content", cms.core.fields.StreamField(block_lookup={})), | ||
( | ||
"listing_image", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="images.customimage", | ||
), | ||
), | ||
( | ||
"social_image", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="images.customimage", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
bases=("wagtailcore.page", models.Model), | ||
), | ||
] |
Empty file.
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,40 @@ | ||
from typing import ClassVar | ||
|
||
from django.db import models | ||
from wagtail.admin.panels import FieldPanel, InlinePanel | ||
from wagtail.search import index | ||
|
||
from cms.core.blocks.stream_blocks import CoreStoryBlock | ||
from cms.core.fields import StreamField | ||
from cms.core.models import BasePage | ||
|
||
|
||
class InformationPage(BasePage): # type: ignore[django-manager-missing] | ||
"""A generic information page model.""" | ||
|
||
template = "templates/pages/information_page.html" | ||
|
||
parent_page_types: ClassVar[list[str]] = [ | ||
# Ensures that the information page can only be created under the home page | ||
"home.HomePage", | ||
# Ensures that the information page can be created under another information page | ||
"standard_pages.InformationPage", | ||
] | ||
|
||
summary = models.TextField(max_length=255) | ||
last_updated = models.DateField(blank=True, null=True) | ||
content = StreamField(CoreStoryBlock()) | ||
|
||
content_panels: ClassVar[list[FieldPanel]] = [ | ||
*BasePage.content_panels, | ||
FieldPanel("summary"), | ||
FieldPanel("last_updated"), | ||
FieldPanel("content"), | ||
InlinePanel("page_related_pages", label="Related pages"), | ||
] | ||
|
||
search_fields: ClassVar[list[index.SearchField | index.AutocompleteField]] = [ | ||
*BasePage.search_fields, | ||
index.SearchField("summary"), | ||
index.SearchField("content"), | ||
] |
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