-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from molgen/add-wagtailforms-v3
Add wagtailforms v3
- Loading branch information
Showing
5 changed files
with
141 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Generated by Django 2.2.9 on 2020-03-08 19:09 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import modelcluster.fields | ||
import wagtail.core.blocks | ||
import wagtail.core.fields | ||
import wagtail.snippets.blocks | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailcore', '0041_group_collection_permissions_verbose_name_plural'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('base', '0050_auto_20200119_1857'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='FormPage', | ||
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')), | ||
('to_address', models.CharField(blank=True, help_text='Optional - form submissions will be emailed to these addresses. Separate multiple addresses by comma.', max_length=255, verbose_name='to address')), | ||
('from_address', models.CharField(blank=True, max_length=255, verbose_name='from address')), | ||
('subject', models.CharField(blank=True, max_length=255, verbose_name='subject')), | ||
('sidebar', wagtail.core.fields.StreamField([('editor', wagtail.core.blocks.RichTextBlock(features=['h4', 'h5', 'h6', 'bold', 'italic', 'link', 'document-link'], label='Editor')), ('contacts', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('contact', wagtail.snippets.blocks.SnippetChooserBlock('personal.Contact', label='Contact')), ('information', wagtail.core.blocks.TextBlock(label='Information', required=False))]), icon='user', label='Contacts', template='base/blocks/contact_list_block.html'))], blank=True, verbose_name='Sidebar Content')), | ||
('sidebar_en', wagtail.core.fields.StreamField([('editor', wagtail.core.blocks.RichTextBlock(features=['h4', 'h5', 'h6', 'bold', 'italic', 'link', 'document-link'], label='Editor')), ('contacts', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('contact', wagtail.snippets.blocks.SnippetChooserBlock('personal.Contact', label='Contact')), ('information', wagtail.core.blocks.TextBlock(label='Information', required=False))]), icon='user', label='Contacts', template='base/blocks/contact_list_block.html'))], blank=True, null=True, verbose_name='Sidebar Content')), | ||
('sidebar_de', wagtail.core.fields.StreamField([('editor', wagtail.core.blocks.RichTextBlock(features=['h4', 'h5', 'h6', 'bold', 'italic', 'link', 'document-link'], label='Editor')), ('contacts', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('contact', wagtail.snippets.blocks.SnippetChooserBlock('personal.Contact', label='Contact')), ('information', wagtail.core.blocks.TextBlock(label='Information', required=False))]), icon='user', label='Contacts', template='base/blocks/contact_list_block.html'))], blank=True, null=True, verbose_name='Sidebar Content')), | ||
('intro', wagtail.core.fields.RichTextField(blank=True)), | ||
('intro_en', wagtail.core.fields.RichTextField(blank=True, null=True)), | ||
('intro_de', wagtail.core.fields.RichTextField(blank=True, null=True)), | ||
('thank_you_text', wagtail.core.fields.RichTextField(blank=True)), | ||
('thank_you_text_en', wagtail.core.fields.RichTextField(blank=True, null=True)), | ||
('thank_you_text_de', wagtail.core.fields.RichTextField(blank=True, null=True)), | ||
('subscribers', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('wagtailcore.page',), | ||
), | ||
migrations.CreateModel( | ||
name='FormField', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('sort_order', models.IntegerField(blank=True, editable=False, null=True)), | ||
('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 separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='choices')), | ||
('default_value', models.CharField(blank=True, help_text='Default value. Comma separated values supported for checkboxes.', max_length=255, 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='base.FormPage')), | ||
], | ||
options={ | ||
'ordering': ['sort_order'], | ||
'abstract': False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{% extends 'base/page.html' %} | ||
|
||
{% load wagtailcore_tags static %} | ||
|
||
{% block head %} | ||
{{ block.super }} | ||
{% endblock %} | ||
|
||
{% block page_content %} | ||
<h2 class="title is-2">{{ page.title }}</h2> | ||
|
||
<div id="content" class="content"> | ||
{{ page.intro|richtext }} | ||
<form action="{% pageurl page %}" method="POST"> | ||
{% csrf_token %} | ||
<table> | ||
{{ form.as_table }} | ||
</table> | ||
<input type="submit"> | ||
</form> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% extends 'base/page.html' %} | ||
|
||
{% load wagtailcore_tags static %} | ||
|
||
{% block head %} | ||
{{ block.super }} | ||
{% endblock %} | ||
|
||
{% block page_content %} | ||
<h2 class="title is-2">{{ page.title }}</h2> | ||
|
||
<div id="content" class="content"> | ||
{{ page.thank_you_text|richtext }} | ||
</div> | ||
{% endblock %} |