Skip to content

Commit

Permalink
Feature: Delete YoutubeRegretsReporterExtensionPage (#12573)
Browse files Browse the repository at this point in the history
* Feature: Remove YoutubeRegretsReporterExtensionPage

* Fix: Remove unused import

* Feature: Migration files for YoutubeRegretsReporterExtensionPage model deletion
  • Loading branch information
AdalbertoMoz authored Jul 3, 2024
1 parent f1cbc31 commit 52a2fdb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
YoutubeRegrets2021Page,
YoutubeRegrets2022Page,
YoutubeRegretsPage,
YoutubeRegretsReporterExtensionPage,
YoutubeRegretsReporterPage,
)

from .bannered_campaign_page import BanneredCampaignPageFactory
from .campaign_page import CampaignIndexPageFactory


Expand All @@ -32,19 +30,6 @@ class Meta:
regret_stories = Faker("streamfield", fields=["regret_story"] * 28)


class YoutubeRegretsReporterExtensionPageFactory(PageFactory):
class Meta:
model = YoutubeRegretsReporterExtensionPage
exclude = (
"title_text",
"header_text",
"header",
)

title = "Regrets Reporter Extension"
slug = "regretsreporter"


class YoutubeRegrets2021PageFactory(PageFactory):
class Meta:
model = YoutubeRegrets2021Page
Expand Down Expand Up @@ -124,28 +109,3 @@ def generate(seed):
YoutubeRegrets2021PageFactory.create(parent=youtube_regrets)
YoutubeRegrets2022PageFactory.create(parent=youtube_regrets)
reseed(seed)

# Youtube Extension Landing page
# Checking for a bannered campaign page titled "Youtube Regrets", and then creating the landing page if
# it does not exist.
try:
youtube_bannered_campaign_page = WagtailPage.objects.child_of(home_page).get(title=title)
print("Youtube Regrets bannered campaign page exists")
# If extension landing page does not exist, create it.
if not WagtailPage.objects.child_of(youtube_bannered_campaign_page).type(YoutubeRegretsReporterExtensionPage):
print("Generating extension landing page")
YoutubeRegretsReporterExtensionPageFactory.create(parent=youtube_bannered_campaign_page)

# If bannered "YouTube Regrets" campaign page does not exist, create it and the extension landing page.
except WagtailPage.DoesNotExist:
print("Generating a youtube bannered campaign page and extension landing page")
youtube_bannered_campaign_page = BanneredCampaignPageFactory.create(
parent=home_page,
title="YouTube Regrets",
slug="youtube",
show_in_menus=False,
live=True,
)
YoutubeRegretsReporterExtensionPageFactory.create(parent=youtube_bannered_campaign_page)

reseed(seed)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 4.2.11 on 2024-07-03 23:27

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("wagtailpages", "0142_alter_blogindexpage_callout_box"),
]

operations = [
migrations.DeleteModel(
name="YoutubeRegretsReporterExtensionPage",
),
]
1 change: 0 additions & 1 deletion network-api/networkapi/wagtailpages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,5 @@
YoutubeRegrets2021Page,
YoutubeRegrets2022Page,
YoutubeRegretsPage,
YoutubeRegretsReporterExtensionPage,
YoutubeRegretsReporterPage,
)
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ class BanneredCampaignPage(PrimaryPage):
"PublicationPage",
"OpportunityPage",
"ArticlePage",
"YoutubeRegretsReporterExtensionPage",
"YoutubeRegrets2021Page",
"YoutubeRegrets2022Page",
"YoutubeRegretsPage",
Expand Down
18 changes: 0 additions & 18 deletions network-api/networkapi/wagtailpages/pagemodels/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,3 @@ class YoutubeRegrets2022Page(BasePage):
class Meta:
verbose_name = "YouTube Regrets 2022 Page"
verbose_name_plural = "YouTube Regrets 2022 Pages"


class YoutubeRegretsReporterExtensionPage(BasePage):
template = "wagtailpages/pages/regrets-reporter-landing-page/youtube_regrets_reporter_extension.html"
max_count = 1

translatable_fields = [
# Promote tab fields
SynchronizedField("slug"),
TranslatableField("seo_title"),
SynchronizedField("show_in_menus"),
TranslatableField("search_description"),
SynchronizedField("search_image"),
# Content tab fields
TranslatableField("title"),
]

content_panels = Page.content_panels # Needed for wagtail-modeltranslation to work

This file was deleted.

0 comments on commit 52a2fdb

Please sign in to comment.