Restructure fields in editor pages
Move as much as possible out of the "Content" tab, so that's just about the actual content
This commit is contained in:
parent
2d537d3b10
commit
bccc948995
3 changed files with 17 additions and 8 deletions
|
@ -61,7 +61,7 @@ class BlogPostPage(BaseContentPage):
|
||||||
tags = ParentalManyToManyField("blog.BlogPostTagPage", blank=True)
|
tags = ParentalManyToManyField("blog.BlogPostTagPage", blank=True)
|
||||||
date = models.DateField(default=timezone.now)
|
date = models.DateField(default=timezone.now)
|
||||||
|
|
||||||
content_panels = BaseContentPage.content_panels + [
|
promote_panels = BaseContentPage.promote_panels + [
|
||||||
FieldPanel("date"),
|
FieldPanel("date"),
|
||||||
AutocompletePanel("tags"),
|
AutocompletePanel("tags"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -12,7 +12,7 @@ from django.utils.decorators import method_decorator
|
||||||
from django.utils.functional import cached_property, classproperty
|
from django.utils.functional import cached_property, classproperty
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from django.views.decorators.cache import cache_page
|
from django.views.decorators.cache import cache_page
|
||||||
from wagtail.admin.panels import FieldPanel
|
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
|
||||||
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
|
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
|
||||||
from wagtail.contrib.settings.models import BaseSetting, register_setting
|
from wagtail.contrib.settings.models import BaseSetting, register_setting
|
||||||
from wagtail.fields import RichTextField, StreamField
|
from wagtail.fields import RichTextField, StreamField
|
||||||
|
@ -75,8 +75,13 @@ class BaseContentPage(BasePage, MetadataMixin):
|
||||||
|
|
||||||
content_panels = BasePage.content_panels + [
|
content_panels = BasePage.content_panels + [
|
||||||
FieldPanel("subtitle"),
|
FieldPanel("subtitle"),
|
||||||
|
MultiFieldPanel(
|
||||||
|
[
|
||||||
FieldPanel("hero_image"),
|
FieldPanel("hero_image"),
|
||||||
FieldPanel("hero_unsplash_photo", widget=UnsplashPhotoChooser),
|
FieldPanel("hero_unsplash_photo", widget=UnsplashPhotoChooser),
|
||||||
|
],
|
||||||
|
heading="Hero image",
|
||||||
|
),
|
||||||
FieldPanel("body"),
|
FieldPanel("body"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -172,13 +177,13 @@ class BaseListingPage(RoutablePageMixin, BaseContentPage):
|
||||||
content_panels = [
|
content_panels = [
|
||||||
panel
|
panel
|
||||||
for panel in BaseContentPage.content_panels
|
for panel in BaseContentPage.content_panels
|
||||||
if panel.field_name != "subtitle"
|
if getattr(panel, "field_name", None) != "subtitle"
|
||||||
]
|
]
|
||||||
|
|
||||||
search_fields = [
|
search_fields = [
|
||||||
panel
|
panel
|
||||||
for panel in BaseContentPage.search_fields
|
for panel in BaseContentPage.search_fields
|
||||||
if panel.field_name != "subtitle"
|
if getattr(panel, "field_name", None) != "subtitle"
|
||||||
]
|
]
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -27,8 +27,12 @@ class SpotifyPlaylistPage(BaseContentPage):
|
||||||
content_panels = [
|
content_panels = [
|
||||||
panel
|
panel
|
||||||
for panel in BaseContentPage.content_panels
|
for panel in BaseContentPage.content_panels
|
||||||
if panel.field_name != "subtitle"
|
if getattr(panel, "field_name", None) != "subtitle"
|
||||||
] + [FieldPanel("spotify_playlist_id")]
|
]
|
||||||
|
|
||||||
|
settings_panels = BaseContentPage.settings_panels + [
|
||||||
|
FieldPanel("spotify_playlist_id")
|
||||||
|
]
|
||||||
|
|
||||||
search_fields = [
|
search_fields = [
|
||||||
panel
|
panel
|
||||||
|
|
Loading…
Reference in a new issue