Remove subtitle from listing pages

This commit is contained in:
Jake Howard 2022-08-27 19:21:51 +01:00
parent e6ee7d475a
commit 27bce00c46
Signed by: jake
GPG Key ID: 57AFB45680EDD477
5 changed files with 70 additions and 3 deletions

View File

@ -1,9 +1,9 @@
from website.common.factories import BaseContentFactory
from website.common.factories import BaseContentFactory, BaseListingFactory
from . import models
class BlogPostListPageFactory(BaseContentFactory):
class BlogPostListPageFactory(BaseListingFactory):
class Meta:
model = models.BlogPostListPage

View File

@ -0,0 +1,33 @@
# Generated by Django 4.0.6 on 2022-08-27 18:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("blog", "0020_alter_blogpostcollectionlistpage_body_and_more"),
]
operations = [
migrations.RemoveField(
model_name="blogpostcollectionlistpage",
name="subtitle",
),
migrations.RemoveField(
model_name="blogpostcollectionpage",
name="subtitle",
),
migrations.RemoveField(
model_name="blogpostlistpage",
name="subtitle",
),
migrations.RemoveField(
model_name="blogposttaglistpage",
name="subtitle",
),
migrations.RemoveField(
model_name="blogposttagpage",
name="subtitle",
),
]

View File

@ -9,11 +9,15 @@ class BaseContentFactory(wagtail_factories.PageFactory):
subtitle = factory.Faker("bs")
class BaseListingFactory(wagtail_factories.PageFactory):
title = factory.Faker("catch_phrase")
class ContentPageFactory(BaseContentFactory):
class Meta:
model = models.ContentPage
class ListingPageFactory(BaseContentFactory):
class ListingPageFactory(BaseListingFactory):
class Meta:
model = models.ListingPage

View File

@ -0,0 +1,17 @@
# Generated by Django 4.0.6 on 2022-08-27 18:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("common", "0019_alter_contentpage_body_alter_listingpage_body"),
]
operations = [
migrations.RemoveField(
model_name="listingpage",
name="subtitle",
),
]

View File

@ -178,6 +178,19 @@ class ContentPage(BaseContentPage):
class BaseListingPage(RoutablePageMixin, BaseContentPage):
PAGE_SIZE = 20
subtitle = None
content_panels = [
panel
for panel in BaseContentPage.content_panels
if panel.field_name != "subtitle"
]
search_fields = [
panel
for panel in BaseContentPage.search_fields
if panel.field_name != "subtitle"
]
class Meta:
abstract = True