From a3375debf982b72c1b73aaf4ad4f1136b55d037e Mon Sep 17 00:00:00 2001 From: James Biggs <62654785+jamesbiggs@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:31:00 +0100 Subject: [PATCH] EDEV-96: FIX `featured_article` on `RecordArticlePage` (#1615) --- ...lter_recordarticlepage_featured_article.py | 29 +++++++++++++++++ etna/articles/models.py | 8 +++-- ...r_highlightgallerypage_featured_article.py | 32 +++++++++++++++++++ etna/collections/models.py | 2 +- 4 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 etna/articles/migrations/0105_alter_recordarticlepage_featured_article.py create mode 100644 etna/collections/migrations/0056_alter_highlightgallerypage_featured_article.py diff --git a/etna/articles/migrations/0105_alter_recordarticlepage_featured_article.py b/etna/articles/migrations/0105_alter_recordarticlepage_featured_article.py new file mode 100644 index 000000000..30a474a9a --- /dev/null +++ b/etna/articles/migrations/0105_alter_recordarticlepage_featured_article.py @@ -0,0 +1,29 @@ +# Generated by Django 5.0.4 on 2024-04-24 09:20 +# etna:allowAlterField + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("articles", "0104_alter_articlepage_body_alter_focusedarticlepage_body"), + ("wagtailcore", "0091_remove_revision_submitted_for_moderation"), + ] + + operations = [ + migrations.AlterField( + model_name="recordarticlepage", + name="featured_article", + field=models.ForeignKey( + blank=True, + help_text="Select a page to display in the featured area. This can be an Article, Focused Article or Record Article.", + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="wagtailcore.page", + verbose_name="featured article", + ), + ), + ] diff --git a/etna/articles/models.py b/etna/articles/models.py index 64b403604..9cb6188d9 100755 --- a/etna/articles/models.py +++ b/etna/articles/models.py @@ -582,7 +582,7 @@ class RecordArticlePage( on_delete=models.SET_NULL, related_name="+", help_text=_( - "Select a page to display in the featured area. This can be an Article or Focused Article." + "Select a page to display in the featured area. This can be an Article, Focused Article or Record Article." ), verbose_name=_("featured article"), ) @@ -639,7 +639,11 @@ class Meta: FieldPanel("featured_highlight_gallery"), PageChooserPanel( "featured_article", - ["articles.ArticlePage", "articles.FocusedArticlePage"], + [ + "articles.ArticlePage", + "articles.FocusedArticlePage", + "articles.RecordArticlePage", + ], ), FieldPanel("promoted_links"), ] diff --git a/etna/collections/migrations/0056_alter_highlightgallerypage_featured_article.py b/etna/collections/migrations/0056_alter_highlightgallerypage_featured_article.py new file mode 100644 index 000000000..a5d7ef52b --- /dev/null +++ b/etna/collections/migrations/0056_alter_highlightgallerypage_featured_article.py @@ -0,0 +1,32 @@ +# Generated by Django 5.0.4 on 2024-04-24 09:20 +# etna:allowAlterField + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "collections", + "0055_remove_highlightgallerypage_featured_record_article_and_more", + ), + ("wagtailcore", "0091_remove_revision_submitted_for_moderation"), + ] + + operations = [ + migrations.AlterField( + model_name="highlightgallerypage", + name="featured_article", + field=models.ForeignKey( + blank=True, + help_text="Select a page to display in the featured area. This can be an Article, Focused Article or Record Article.", + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="wagtailcore.page", + verbose_name="featured article", + ), + ), + ] diff --git a/etna/collections/models.py b/etna/collections/models.py index cf9669c6e..8ed36f7d8 100644 --- a/etna/collections/models.py +++ b/etna/collections/models.py @@ -769,7 +769,7 @@ class HighlightGalleryPage(TopicalPageMixin, ContentWarningMixin, BasePageWithIn on_delete=models.SET_NULL, related_name="+", help_text=_( - "Select a page to display in the featured area. This can be an Article, Focused Article, or Record Article." + "Select a page to display in the featured area. This can be an Article, Focused Article or Record Article." ), verbose_name=_("featured article"), )