Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information page cms 179 test rebase #27

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
64ca28f
Standard_pages app creation
nehakerung Nov 1, 2024
d4a31ec
Addition of InformationPage class in models
nehakerung Nov 4, 2024
a7cd051
Changes to InformationPage class models
nehakerung Nov 4, 2024
ae1fcc9
Front end creation
nehakerung Nov 4, 2024
ea79424
Addition of template location and minor changes on information_page t…
nehakerung Nov 4, 2024
3dc29b9
Added cms.standard_pages to installed_apps
nehakerung Nov 5, 2024
be34d8d
Updated apps.py for standard_pages to be similar to pre-existing apps
nehakerung Nov 5, 2024
ef12642
Modified InformationPage in models
nehakerung Nov 5, 2024
daf14b3
Updated template for informationPage
nehakerung Nov 5, 2024
1f54e2d
Modified models for standard_pages
nehakerung Nov 5, 2024
5b87e7b
Modified front end
nehakerung Nov 6, 2024
332a180
working branch
nehakerung Nov 7, 2024
6d8b2d3
Django models for information page updated and the template for the i…
sanjeevz3009 Nov 7, 2024
0da84ac
Zombie code removed
sanjeevz3009 Nov 7, 2024
bb11fbc
Unnused files deleted
sanjeevz3009 Nov 7, 2024
b63e91d
Mirgation file formatted
sanjeevz3009 Nov 7, 2024
34bf9c1
django-manager-missing ignore added
sanjeevz3009 Nov 7, 2024
c1c49dd
TODO comment removed and docstrings added
sanjeevz3009 Nov 7, 2024
a578042
Information code formatted
sanjeevz3009 Nov 7, 2024
cef4019
Docstring rewritten to make it more concise
sanjeevz3009 Nov 7, 2024
4a253ac
Updated body to content
sanjeevz3009 Nov 7, 2024
8e63c60
Conditional for last_updated added, InformationPage class docstring s…
sanjeevz3009 Nov 8, 2024
54df00d
summary TextField null=true removed and the migration file regenerate…
sanjeevz3009 Nov 8, 2024
e42d458
Removing the conditional as per requirement the summary field is requ…
sanjeevz3009 Nov 8, 2024
6628e9a
InformationPage restrictions added
sanjeevz3009 Nov 8, 2024
1bc7bbf
Code formatted
sanjeevz3009 Nov 8, 2024
f60e637
Comments added
sanjeevz3009 Nov 11, 2024
7cd606b
Moved parent_page code
nehakerung Nov 11, 2024
3e48738
Removed extra blank lines for lint.py
nehakerung Nov 11, 2024
1256330
Custom CSS added to make video embeds responsive
sanjeevz3009 Nov 11, 2024
e70657e
Formatting fixed
sanjeevz3009 Nov 11, 2024
65b6bc9
Ignore Unexpected property "left" property-disallowed-list rule
sanjeevz3009 Nov 12, 2024
1899352
cms/release_calendar/models.py formating fixed
sanjeevz3009 Nov 12, 2024
cf51132
Replace Docker Desktop setup with Colima (#24)
MebinAbraham Nov 12, 2024
5a6f5c6
Add Cookie banner and Google Tag Manager snippet (#19)
kacperpONS Nov 12, 2024
5e49893
Analysis page and series (#20)
zerolab Nov 14, 2024
5e5999f
Addition of equation partials
nehakerung Nov 14, 2024
d854cb8
Deleted media files and made lint, format test pass
nehakerung Nov 14, 2024
22eccae
Repeated code remove, /media added to .gitignore, media file removed
nehakerung Nov 15, 2024
0003ec4
Check tests pass
nehakerung Nov 15, 2024
597bf73
Custom sign commit
nehakerung Nov 15, 2024
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,6 @@ static/

# mkdocs
/site

# Media files
/media
4 changes: 4 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,16 @@ disable=raw-checker-failed,
wrong-import-order,
missing-module-docstring,
too-many-ancestors,
too-few-public-methods,
missing-class-docstring,
fixme

# note:
# - wrong-import-order: covered by ruff
# - missing-module-docstring: because they should be self-explanatory
# - too-many-ancestors: because of our and Wagtail's use of mixins
# - too-few-public-methods: because of Django Meta classes
# - missing-class-docstring: mostly because of Django classes.
# - fixme: because we want to leave TODO notes for future features.

# Enable the message, report, category or checker with the given id(s). You can
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ lint: lint-py lint-html lint-frontend ## Run all linters (python, html, front-en
.PHONY: lint-py
lint-py: ## Run all Python linters (ruff/pylint/mypy).
poetry run ruff check .
poetry run ruff format --check .
find . -type f -name "*.py" | xargs poetry run pylint --reports=n --output-format=colorized --rcfile=.pylintrc --django-settings-module=cms.settings.production -j 0
make mypy

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Ensure you have the following installed:
managing Python versions.
2. **[Poetry](https://python-poetry.org/)**: This is used to manage package dependencies and virtual
environments.
3. **[Docker](https://docs.docker.com/engine/install/)** and **[Docker Compose](https://docs.docker.com/compose/)**.
3. **[Colima](https://github.com/ONSdigital/dp-compose/blob/main/setting-up-colima-locally.md)** for running the project in Docker containers.
4. **[PostgreSQL](https://www.postgresql.org/)** for the database. Provided as container via `docker-compose.yml` when using the Docker setup.
5. **[Node](https://nodejs.org/en)** and **[`nvm` (Node Version Manager)](https://github.com/nvm-sh/nvm)** for front-end tooling.
6. **Operation System**: Ubuntu/MacOS
Expand Down Expand Up @@ -261,11 +261,11 @@ make megalint
Wagtail is built on [Django](https://djangoproject.com/) and changes to its models may require generating and
running schema migrations. For full details see the [Django documentation on migrations](https://docs.djangoproject.com/en/5.1/topics/migrations/)

Below are the commands you will most commonly use:
Below are the commands you will most commonly use, note that these have to be run inside the container.

```bash
# Check if you need to generate any new migrations after changes to the model
poetru run django-admin makemigrations --check
poetry run django-admin makemigrations --check

# Generate migrations
poetry run django-admin makemigrations
Expand Down
Empty file added cms/analysis/__init__.py
Empty file.
59 changes: 59 additions & 0 deletions cms/analysis/blocks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from typing import TYPE_CHECKING, ClassVar

from django.utils.text import slugify
from wagtail.blocks import RichTextBlock, StreamBlock, StructBlock
from wagtail.embeds.blocks import EmbedBlock
from wagtail.images.blocks import ImageChooserBlock
from wagtailmath.blocks import MathBlock

from cms.core.blocks import (
DocumentsBlock,
HeadingBlock,
ONSEmbedBlock,
PanelBlock,
RelatedContentBlock,
RelatedLinksBlock,
)

if TYPE_CHECKING:
from wagtail.blocks import StructValue


class SectionContentBlock(StreamBlock):
"""The analysis section content StreamField block definition."""

rich_text = RichTextBlock()
panel = PanelBlock()
image = ImageChooserBlock(group="Media")
documents = DocumentsBlock(group="Media")
embed = EmbedBlock(group="Media")
equation = MathBlock(group="DataVis", icon="decimal")
ons_embed = ONSEmbedBlock(group="DataVis", label="ONS General Embed")
related_links = RelatedLinksBlock(RelatedContentBlock(), icon="link")

class Meta:
template = "templates/components/streamfield/stream_block.html"
block_counts: ClassVar[dict[str, dict]] = {"related_links": {"max_num": 1}}


class SectionBlock(StructBlock):
"""The analysis section block definition."""

title = HeadingBlock()
content = SectionContentBlock()

def to_table_of_contents_items(self, value: "StructValue") -> list[dict[str, str]]:
"""Convert the value to the table of contents component macro format."""
return [{"url": "#" + slugify(value["title"]), "text": value["title"]}]

class Meta:
template = "templates/components/streamfield/analysis_section_block.html"


class AnalysisStoryBlock(StreamBlock):
"""The analysis StreamField block definition."""

section = SectionBlock()

class Meta:
template = "templates/components/streamfield/stream_block.html"
104 changes: 104 additions & 0 deletions cms/analysis/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Generated by Django 5.1.2 on 2024-11-04 17:20

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

import cms.core.fields


class Migration(migrations.Migration):
initial = True

dependencies = [
("core", "0002_contactdetails"),
("images", "0002_customimage_description"),
("wagtailcore", "0094_alter_page_locale"),
]

operations = [
migrations.CreateModel(
name="AnalysisSeries",
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",
),
),
],
options={
"abstract": False,
},
bases=(wagtail.contrib.routable_page.models.RoutablePageMixin, "wagtailcore.page"),
),
migrations.CreateModel(
name="AnalysisPage",
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)),
("news_headline", models.CharField(blank=True, max_length=255)),
("summary", wagtail.fields.RichTextField()),
("main_points_summary", wagtail.fields.RichTextField()),
("release_date", models.DateField()),
("next_release_date", models.DateField(blank=True, null=True)),
("is_accredited", models.BooleanField(default=False)),
("is_census", models.BooleanField(default=False)),
("headline_figures", cms.core.fields.StreamField(blank=True, block_lookup={})),
("content", cms.core.fields.StreamField(block_lookup={})),
("show_cite_this_page", models.BooleanField(default=True)),
(
"contact_details",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="core.contactdetails",
),
),
(
"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.
Loading
Loading