Change to content to Orderable

This commit is contained in:
2024-09-16 20:16:16 +02:00
parent a70db94b2b
commit d1fe5bb187
37 changed files with 718 additions and 371 deletions

View File

@@ -10,98 +10,24 @@ from saburly.custom_editor import FULL_EDITOR
class ServicesPage(Page):
section_one_title = RichTextField(blank=True, features=FULL_EDITOR)
section_one_text = RichTextField(blank=True, features=FULL_EDITOR)
section_one_img = RichTextField(blank=True, features=FULL_EDITOR)
section_two_title = RichTextField(blank=True, features=FULL_EDITOR)
section_two_text = RichTextField(blank=True, features=FULL_EDITOR)
section_two_img = RichTextField(blank=True, features=FULL_EDITOR)
section_three_title = RichTextField(blank=True, features=FULL_EDITOR)
section_three_text = RichTextField(blank=True, features=FULL_EDITOR)
section_three_img = RichTextField(blank=True, features=FULL_EDITOR)
section_four_title = RichTextField(blank=True, features=FULL_EDITOR)
section_four_text = RichTextField(blank=True, features=FULL_EDITOR)
section_four_img = RichTextField(blank=True, features=FULL_EDITOR)
section_five_title = RichTextField(blank=True, features=FULL_EDITOR)
section_five_text = RichTextField(blank=True, features=FULL_EDITOR)
section_five_img = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_one = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_one_img = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_two = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_two_img = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_three = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_three_img = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_four = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_four_img = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_five = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_five_img = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_six = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_six_img = RichTextField(blank=True, features=FULL_EDITOR)
intro_title = RichTextField(blank=True, features=FULL_EDITOR)
intro_text = RichTextField(blank=True, features=FULL_EDITOR)
intro_image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
content_panels = Page.content_panels + [
MultiFieldPanel([
FieldPanel('section_one_title'),
FieldPanel('section_one_text'),
FieldPanel('section_one_img'),
], heading="Section 1"),
MultiFieldPanel([
FieldPanel('section_two_title'),
FieldPanel('section_two_text'),
FieldPanel('section_two_img'),
], heading="Section 2"),
MultiFieldPanel([
FieldPanel('section_three_title'),
FieldPanel('section_three_text'),
FieldPanel('section_three_img'),
], heading="Section 3"),
MultiFieldPanel([
FieldPanel('section_four_title'),
FieldPanel('section_four_text'),
FieldPanel('section_four_img'),
], heading="Section 4"),
MultiFieldPanel([
FieldPanel('section_five_title'),
FieldPanel('section_five_text'),
FieldPanel('section_five_img'),
], heading="Section 5"),
MultiFieldPanel([
FieldPanel('sub_section_one'),
FieldPanel('sub_section_one_img'),
FieldPanel('sub_section_two'),
FieldPanel('sub_section_two_img'),
FieldPanel('sub_section_three'),
FieldPanel('sub_section_three_img'),
FieldPanel('sub_section_four'),
FieldPanel('sub_section_four_img'),
FieldPanel('sub_section_five'),
FieldPanel('sub_section_five_img'),
FieldPanel('sub_section_six'),
FieldPanel('sub_section_six_img'),
], heading="Section 5 Subfields"),
FieldPanel('intro_title'),
FieldPanel('intro_text'),
FieldPanel('intro_image'),
], heading="Intro Section"),
InlinePanel('carousel_services', heading="Carousel Services", label="Carousel Services"),
InlinePanel('sections_services', heading="Sections Services", label="Sections Services"),
InlinePanel('subsections_services', heading="Sub-Sections Services", label="Sub-Sections Services"),
]
class ServicesPageCarousel(Orderable):
@@ -119,4 +45,40 @@ class ServicesPageCarousel(Orderable):
panels = [
FieldPanel('carousel_name'),
FieldPanel('carousel_image'),
]
class ServicesPageSections(Orderable):
page = ParentalKey(ServicesPage, on_delete=models.CASCADE, related_name='sections_services')
section_title = RichTextField(blank=True, features=FULL_EDITOR)
section_text = RichTextField(blank=True, features=FULL_EDITOR)
section_image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
panels = [
FieldPanel('section_title'),
FieldPanel('section_text'),
FieldPanel('section_image'),
]
class ServicesPageSubSection(Orderable):
page = ParentalKey(ServicesPage, on_delete=models.CASCADE, related_name='subsections_services')
sub_section_text = RichTextField(blank=True, features=FULL_EDITOR)
sub_section_image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
panels = [
FieldPanel('sub_section_text'),
FieldPanel('sub_section_image'),
]