53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
from __future__ import unicode_literals
|
|
|
|
from django.db import models
|
|
|
|
from modelcluster.fields import ParentalKey
|
|
|
|
from wagtail.models import Page
|
|
from wagtail.contrib.forms.models import AbstractEmailForm, AbstractFormField
|
|
from wagtail.fields import RichTextField
|
|
from wagtail.admin.panels import FieldPanel, FieldRowPanel,InlinePanel, MultiFieldPanel
|
|
|
|
|
|
class FormField(AbstractFormField):
|
|
page = ParentalKey(
|
|
'ContactPage',
|
|
on_delete = models.CASCADE,
|
|
related_name= 'form_fields'
|
|
)
|
|
|
|
class ContactPage(AbstractEmailForm):
|
|
|
|
section_one_title = RichTextField(blank=True)
|
|
section_one_text = RichTextField(blank=True)
|
|
section_one_img = RichTextField(blank=True)
|
|
|
|
section_two_title = RichTextField(blank=True)
|
|
section_two_text = RichTextField(blank=True)
|
|
section_two_img = RichTextField(blank=True)
|
|
|
|
content_panels = AbstractEmailForm.content_panels + [
|
|
MultiFieldPanel([
|
|
FieldPanel('section_one_title', classname="full"),
|
|
FieldPanel('section_one_text', classname="full"),
|
|
FieldPanel('section_one_img', classname="full"),
|
|
], heading="Section One"),
|
|
|
|
MultiFieldPanel([
|
|
FieldPanel('section_two_title', classname="full"),
|
|
FieldPanel('section_two_text', classname="full"),
|
|
FieldPanel('section_two_img', classname="full"),
|
|
], heading="Section Two"),
|
|
|
|
InlinePanel('form_fields',label='Form Fields'),
|
|
MultiFieldPanel([
|
|
FieldRowPanel([
|
|
FieldPanel('from_address', classname='saburly-input'),
|
|
FieldPanel('to_address', classname='saburly-input'),
|
|
]),
|
|
FieldPanel('subject'),
|
|
], heading = 'Email Settings'),
|
|
]
|
|
|