This commit is contained in:
2024-09-10 20:21:33 +02:00
parent 1cc67371c5
commit 9b0cb634b5
276 changed files with 16434 additions and 439 deletions

0
contact/__init__.py Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

3
contact/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
contact/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class ContactConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'contact'

View File

@@ -0,0 +1,28 @@
# Generated by Django 5.0.8 on 2024-09-06 19:06
import django.db.models.deletion
import wagtail.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('wagtailcore', '0094_alter_page_locale'),
]
operations = [
migrations.CreateModel(
name='ContactPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('contact', wagtail.fields.RichTextField(blank=True)),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
]

View File

@@ -0,0 +1,31 @@
# Generated by Django 5.0.8 on 2024-09-07 14:11
import django.db.models.deletion
import wagtail.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contact', '0001_initial'),
('wagtailcore', '0094_alter_page_locale'),
]
operations = [
migrations.CreateModel(
name='ContactContactpage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('letsconnect', wagtail.fields.RichTextField(blank=True)),
('mailus', wagtail.fields.RichTextField(blank=True)),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.DeleteModel(
name='ContactPage',
),
]

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0.8 on 2024-09-07 14:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contact', '0002_contactcontactpage_delete_contactpage'),
('wagtailcore', '0094_alter_page_locale'),
]
operations = [
migrations.RenameModel(
old_name='ContactContactpage',
new_name='Contactpage',
),
]

View File

@@ -0,0 +1,44 @@
# Generated by Django 5.0.8 on 2024-09-08 17:39
import wagtail.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contact', '0003_rename_contactcontactpage_contactpage'),
]
operations = [
migrations.RenameField(
model_name='contactpage',
old_name='letsconnect',
new_name='cf1img',
),
migrations.RenameField(
model_name='contactpage',
old_name='mailus',
new_name='cf1text',
),
migrations.AddField(
model_name='contactpage',
name='cf1title',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.AddField(
model_name='contactpage',
name='cf2img',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.AddField(
model_name='contactpage',
name='cf2text',
field=wagtail.fields.RichTextField(blank=True),
),
migrations.AddField(
model_name='contactpage',
name='cf2title',
field=wagtail.fields.RichTextField(blank=True),
),
]

View File

@@ -0,0 +1,50 @@
# Generated by Django 5.0.8 on 2024-09-09 22:40
import django.db.models.deletion
import modelcluster.fields
import wagtail.contrib.forms.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contact', '0004_rename_letsconnect_contactpage_cf1img_and_more'),
]
operations = [
migrations.AddField(
model_name='contactpage',
name='from_address',
field=models.EmailField(blank=True, max_length=255, verbose_name='from address'),
),
migrations.AddField(
model_name='contactpage',
name='subject',
field=models.CharField(blank=True, max_length=255, verbose_name='subject'),
),
migrations.AddField(
model_name='contactpage',
name='to_address',
field=models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, validators=[wagtail.contrib.forms.models.validate_to_address], verbose_name='to address'),
),
migrations.CreateModel(
name='FormField',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('clean_name', models.CharField(blank=True, default='', help_text='Safe name of the form field, the label converted to ascii_snake_case', max_length=255, verbose_name='name')),
('label', models.CharField(help_text='The label of the form field', max_length=255, verbose_name='label')),
('field_type', models.CharField(choices=[('singleline', 'Single line text'), ('multiline', 'Multi-line text'), ('email', 'Email'), ('number', 'Number'), ('url', 'URL'), ('checkbox', 'Checkbox'), ('checkboxes', 'Checkboxes'), ('dropdown', 'Drop down'), ('multiselect', 'Multiple select'), ('radio', 'Radio buttons'), ('date', 'Date'), ('datetime', 'Date/time'), ('hidden', 'Hidden field')], max_length=16, verbose_name='field type')),
('required', models.BooleanField(default=True, verbose_name='required')),
('choices', models.TextField(blank=True, help_text='Comma or new line separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='choices')),
('default_value', models.TextField(blank=True, help_text='Default value. Comma or new line separated values supported for checkboxes.', verbose_name='default value')),
('help_text', models.CharField(blank=True, max_length=255, verbose_name='help text')),
('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='form_fields', to='contact.contactpage')),
],
options={
'ordering': ['sort_order'],
'abstract': False,
},
),
]

View File

@@ -0,0 +1,43 @@
# Generated by Django 5.0.8 on 2024-09-10 16:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contact', '0005_contactpage_from_address_contactpage_subject_and_more'),
]
operations = [
migrations.RenameField(
model_name='contactpage',
old_name='cf1img',
new_name='section_one_img',
),
migrations.RenameField(
model_name='contactpage',
old_name='cf1text',
new_name='section_one_text',
),
migrations.RenameField(
model_name='contactpage',
old_name='cf1title',
new_name='section_one_title',
),
migrations.RenameField(
model_name='contactpage',
old_name='cf2img',
new_name='section_two_img',
),
migrations.RenameField(
model_name='contactpage',
old_name='cf2text',
new_name='section_two_text',
),
migrations.RenameField(
model_name='contactpage',
old_name='cf2title',
new_name='section_two_title',
),
]

View File

52
contact/models.py Normal file
View File

@@ -0,0 +1,52 @@
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'),
]

3
contact/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
contact/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.