diff --git a/network-api/networkapi/wagtailpages/factory/__init__.py b/network-api/networkapi/wagtailpages/factory/__init__.py index 5b4921c214f..ee5111d71db 100644 --- a/network-api/networkapi/wagtailpages/factory/__init__.py +++ b/network-api/networkapi/wagtailpages/factory/__init__.py @@ -10,9 +10,9 @@ homepage, homepage_cause_statement_link, homepage_features, + homepage_highlights, homepage_partner_logos, homepage_take_action, - homepage_usable_news, initiatives_page, locale, opportunity, @@ -40,7 +40,7 @@ def generate(seed): homepage_features.generate(seed) homepage_partner_logos.generate(seed) homepage_take_action.generate(seed) - homepage_usable_news.generate(seed) + homepage_highlights.generate(seed) initiatives_page.generate(seed) opportunity.generate(seed) participate_page_featured_highlights.generate(seed) diff --git a/network-api/networkapi/wagtailpages/factory/homepage_usable_news.py b/network-api/networkapi/wagtailpages/factory/homepage_highlights.py similarity index 60% rename from network-api/networkapi/wagtailpages/factory/homepage_usable_news.py rename to network-api/networkapi/wagtailpages/factory/homepage_highlights.py index ab5b9b3b626..755a03d7521 100644 --- a/network-api/networkapi/wagtailpages/factory/homepage_usable_news.py +++ b/network-api/networkapi/wagtailpages/factory/homepage_highlights.py @@ -2,22 +2,22 @@ from factory.django import DjangoModelFactory from networkapi.utility.faker.helpers import get_homepage, reseed -from networkapi.wagtailpages.models import BlogPage, HomepageNewsYouCanUse +from networkapi.wagtailpages.models import BlogPage, HomepageHighlights from .blog import BlogPageFactory from .homepage import WagtailHomepageFactory -class NewsYouCanUseFactory(DjangoModelFactory): +class HightlightsFactory(DjangoModelFactory): class Meta: abstract = True page = SubFactory(WagtailHomepageFactory) -class HomepageNewsYouCanUseFactory(NewsYouCanUseFactory): +class HomepageHightlightsFactory(HightlightsFactory): class Meta: - model = HomepageNewsYouCanUse + model = HomepageHighlights blog = SubFactory(BlogPageFactory) @@ -29,6 +29,6 @@ def generate(seed): reseed(seed) - home_page.news_you_can_use = [HomepageNewsYouCanUseFactory.build(blog=BlogPage.objects.all()[i]) for i in range(4)] + home_page.highlights = [HomepageHightlightsFactory.build(blog=BlogPage.objects.all()[i]) for i in range(4)] home_page.save() diff --git a/network-api/networkapi/wagtailpages/migrations/0166_homepagehighlights_replace_homepagenewsyoucanuse.py b/network-api/networkapi/wagtailpages/migrations/0166_homepagehighlights_replace_homepagenewsyoucanuse.py new file mode 100644 index 00000000000..6ef7cd55831 --- /dev/null +++ b/network-api/networkapi/wagtailpages/migrations/0166_homepagehighlights_replace_homepagenewsyoucanuse.py @@ -0,0 +1,34 @@ +import django.db.models.deletion +import modelcluster.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailpages", "0165_alter_articlepage_body_alter_blogpage_body_and_more"), + ] + + operations = [ + migrations.RenameModel( + old_name="HomepageNewsYouCanUse", + new_name="HomepageHighlights", + ), + migrations.AddField( + model_name="homepage", + name="ideas_title", + field=models.CharField(default="Ideas", max_length=50), + ), + migrations.AddField( + model_name="homepage", + name="highlights_title", + field=models.CharField(default="The Highlights", max_length=50), + ), + migrations.AlterField( + model_name="homepagehighlights", + name="page", + field=modelcluster.fields.ParentalKey( + on_delete=django.db.models.deletion.CASCADE, related_name="highlights", to="wagtailpages.homepage" + ), + ), + ] diff --git a/network-api/networkapi/wagtailpages/models.py b/network-api/networkapi/wagtailpages/models.py index efd254e1e70..28ab0304ff7 100644 --- a/network-api/networkapi/wagtailpages/models.py +++ b/network-api/networkapi/wagtailpages/models.py @@ -5,8 +5,8 @@ FoundationMetadataPageMixin, Homepage, HomepageFocusAreas, + HomepageHighlights, HomepageIdeasPosts, - HomepageNewsYouCanUse, InitiativesPage, ParticipateHighlights, ParticipateHighlights2, diff --git a/network-api/networkapi/wagtailpages/pagemodels/base.py b/network-api/networkapi/wagtailpages/pagemodels/base.py index 06473963b45..9d94a41abb2 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/base.py +++ b/network-api/networkapi/wagtailpages/pagemodels/base.py @@ -473,10 +473,10 @@ def __str__(self): return self.page.title + "->" + self.blog.title -class HomepageNewsYouCanUse(TranslatableMixin, WagtailOrderable): +class HomepageHighlights(TranslatableMixin, WagtailOrderable): page = ParentalKey( "wagtailpages.Homepage", - related_name="news_you_can_use", + related_name="highlights", ) blog = models.ForeignKey("BlogPage", on_delete=models.CASCADE, related_name="+") panels = [ @@ -774,6 +774,8 @@ def get_banner(self): max_num=1, ) + ideas_title = models.CharField(default="Ideas", max_length=50) + ideas_image = models.ForeignKey( "wagtailimages.Image", null=True, @@ -847,6 +849,9 @@ def get_banner(self): null=True, on_delete=models.SET_NULL, ) + + highlights_title = models.CharField(default="The Highlights", max_length=50) + # Take Action Section take_action_title = models.CharField(default="Take action", max_length=50) @@ -893,13 +898,15 @@ def get_banner(self): ), MultiFieldPanel( [ - InlinePanel("news_you_can_use", min_num=4, max_num=4), + FieldPanel("highlights_title"), + InlinePanel("highlights", min_num=4, max_num=4), ], - heading="News you can use", + heading="The Highlights", classname="collapsible", ), MultiFieldPanel( [ + FieldPanel("ideas_title"), FieldPanel("ideas_image"), FieldPanel("ideas_headline"), InlinePanel("ideas_posts", label="Posts", min_num=3, max_num=3), @@ -955,6 +962,7 @@ def get_banner(self): TranslatableField("hero_intro_heading"), TranslatableField("hero_intro_body"), SynchronizedField("hero_intro_link"), + TranslatableField("ideas_title"), SynchronizedField("ideas_image"), TranslatableField("ideas_headline"), TranslatableField("cause_statement"), @@ -974,7 +982,8 @@ def get_banner(self): TranslatableField("take_action_cards"), TranslatableField("partner_logos"), TranslatableField("ideas_posts"), - TranslatableField("news_you_can_use"), + TranslatableField("highlights"), + TranslatableField("highlights_title"), ] subpage_types = [ diff --git a/network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/news_you_can_use.html b/network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/highlights.html similarity index 97% rename from network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/news_you_can_use.html rename to network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/highlights.html index c874ffc2ea7..b0f9c7308e3 100644 --- a/network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/news_you_can_use.html +++ b/network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/highlights.html @@ -4,14 +4,14 @@