Replace deprecated panel types with FieldPanel

pull/344/head
Matt Westcott 2022-06-15 12:09:54 +02:00 zatwierdzone przez Matt Westcott
rodzic 32d8809877
commit e702c18101
4 zmienionych plików z 27 dodań i 34 usunięć

Wyświetl plik

@ -10,13 +10,10 @@ from wagtail.admin.panels import (
FieldRowPanel,
InlinePanel,
MultiFieldPanel,
PageChooserPanel,
StreamFieldPanel,
)
from wagtail.fields import RichTextField, StreamField
from wagtail.models import Collection, Page
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.search import index
from wagtail.snippets.models import register_snippet
@ -57,7 +54,7 @@ class People(index.Indexed, ClusterableModel):
])
], "Name"),
FieldPanel('job_title'),
ImageChooserPanel('image')
FieldPanel('image')
]
search_fields = [
@ -126,8 +123,8 @@ class StandardPage(Page):
)
content_panels = Page.content_panels + [
FieldPanel('introduction', classname="full"),
StreamFieldPanel('body'),
ImageChooserPanel('image'),
FieldPanel('body'),
FieldPanel('image'),
]
@ -250,31 +247,31 @@ class HomePage(Page):
content_panels = Page.content_panels + [
MultiFieldPanel([
ImageChooserPanel('image'),
FieldPanel('image'),
FieldPanel('hero_text', classname="full"),
MultiFieldPanel([
FieldPanel('hero_cta'),
PageChooserPanel('hero_cta_link'),
FieldPanel('hero_cta_link'),
]),
], heading="Hero section"),
MultiFieldPanel([
ImageChooserPanel('promo_image'),
FieldPanel('promo_image'),
FieldPanel('promo_title'),
FieldPanel('promo_text'),
], heading="Promo section"),
StreamFieldPanel('body'),
FieldPanel('body'),
MultiFieldPanel([
MultiFieldPanel([
FieldPanel('featured_section_1_title'),
PageChooserPanel('featured_section_1'),
FieldPanel('featured_section_1'),
]),
MultiFieldPanel([
FieldPanel('featured_section_2_title'),
PageChooserPanel('featured_section_2'),
FieldPanel('featured_section_2'),
]),
MultiFieldPanel([
FieldPanel('featured_section_3_title'),
PageChooserPanel('featured_section_3'),
FieldPanel('featured_section_3'),
]),
], heading="Featured homepage sections", classname="collapsible")
]
@ -317,8 +314,8 @@ class GalleryPage(Page):
content_panels = Page.content_panels + [
FieldPanel('introduction', classname="full"),
StreamFieldPanel('body'),
ImageChooserPanel('image'),
FieldPanel('body'),
FieldPanel('image'),
FieldPanel('collection'),
]
@ -353,8 +350,8 @@ class FormPage(AbstractEmailForm):
# Note how we include the FormField object via an InlinePanel using the
# related_name value
content_panels = AbstractEmailForm.content_panels + [
ImageChooserPanel('image'),
StreamFieldPanel('body'),
FieldPanel('image'),
FieldPanel('body'),
InlinePanel('form_fields', label="Form fields"),
FieldPanel('thank_you_text', classname="full"),
MultiFieldPanel([

Wyświetl plik

@ -10,12 +10,10 @@ from modelcluster.fields import ParentalKey
from taggit.models import Tag, TaggedItemBase
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
from wagtail.admin.panels import FieldPanel, InlinePanel, StreamFieldPanel
from wagtail.admin.panels import FieldPanel, InlinePanel
from wagtail.fields import StreamField
from wagtail.models import Page, Orderable
from wagtail.images.edit_handlers import ImageChooserPanel
from wagtail.search import index
from wagtail.snippets.edit_handlers import SnippetChooserPanel
from bakerydemo.base.blocks import BaseStreamBlock
@ -35,7 +33,7 @@ class BlogPeopleRelationship(Orderable, models.Model):
'base.People', related_name='person_blog_relationship', on_delete=models.CASCADE
)
panels = [
SnippetChooserPanel('people')
FieldPanel('people')
]
@ -79,8 +77,8 @@ class BlogPage(Page):
content_panels = Page.content_panels + [
FieldPanel('subtitle', classname="full"),
FieldPanel('introduction', classname="full"),
ImageChooserPanel('image'),
StreamFieldPanel('body'),
FieldPanel('image'),
FieldPanel('body'),
FieldPanel('date_published'),
InlinePanel(
'blog_person_relationship', label="Author(s)",
@ -153,7 +151,7 @@ class BlogIndexPage(RoutablePageMixin, Page):
content_panels = Page.content_panels + [
FieldPanel('introduction', classname="full"),
ImageChooserPanel('image'),
FieldPanel('image'),
]
# Speficies that only BlogPage objects can live under this index page

Wyświetl plik

@ -5,13 +5,12 @@ from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from modelcluster.fields import ParentalManyToManyField
from wagtail.admin.panels import (
FieldPanel, MultiFieldPanel, StreamFieldPanel
FieldPanel, MultiFieldPanel
)
from wagtail.fields import StreamField
from wagtail.models import Page
from wagtail.search import index
from wagtail.snippets.models import register_snippet
from wagtail.images.edit_handlers import ImageChooserPanel
from bakerydemo.base.blocks import BaseStreamBlock
@ -124,8 +123,8 @@ class BreadPage(Page):
content_panels = Page.content_panels + [
FieldPanel('introduction', classname="full"),
ImageChooserPanel('image'),
StreamFieldPanel('body'),
FieldPanel('image'),
FieldPanel('body'),
FieldPanel('origin'),
FieldPanel('bread_type'),
MultiFieldPanel(
@ -171,7 +170,7 @@ class BreadsIndexPage(Page):
content_panels = Page.content_panels + [
FieldPanel('introduction', classname="full"),
ImageChooserPanel('image'),
FieldPanel('image'),
]
# Can only have BreadPage children

Wyświetl plik

@ -7,10 +7,9 @@ from django.db import models
from modelcluster.fields import ParentalKey
from wagtail.fields import StreamField
from wagtail.admin.panels import FieldPanel, InlinePanel, StreamFieldPanel
from wagtail.admin.panels import FieldPanel, InlinePanel
from wagtail.models import Orderable, Page
from wagtail.search import index
from wagtail.images.edit_handlers import ImageChooserPanel
from bakerydemo.base.blocks import BaseStreamBlock
from bakerydemo.locations.choices import DAY_CHOICES
@ -120,7 +119,7 @@ class LocationsIndexPage(Page):
content_panels = Page.content_panels + [
FieldPanel('introduction', classname="full"),
ImageChooserPanel('image'),
FieldPanel('image'),
]
@ -166,8 +165,8 @@ class LocationPage(Page):
content_panels = [
FieldPanel('title', classname="full"),
FieldPanel('introduction', classname="full"),
ImageChooserPanel('image'),
StreamFieldPanel('body'),
FieldPanel('image'),
FieldPanel('body'),
FieldPanel('address', classname="full"),
FieldPanel('lat_long'),
InlinePanel('hours_of_operation', label="Hours of Operation"),