wagtailstreamforms 0.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wagtailstreamforms/__init__.py +1 -0
- wagtailstreamforms/blocks.py +93 -0
- wagtailstreamforms/conf.py +35 -0
- wagtailstreamforms/fields.py +218 -0
- wagtailstreamforms/forms.py +61 -0
- wagtailstreamforms/hooks.py +62 -0
- wagtailstreamforms/locale/es/LC_MESSAGES/django.mo +0 -0
- wagtailstreamforms/locale/es/LC_MESSAGES/django.po +328 -0
- wagtailstreamforms/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtailstreamforms/locale/nl/LC_MESSAGES/django.po +464 -0
- wagtailstreamforms/locale/tr/LC_MESSAGES/django.mo +0 -0
- wagtailstreamforms/locale/tr/LC_MESSAGES/django.po +317 -0
- wagtailstreamforms/management/__init__.py +0 -0
- wagtailstreamforms/management/commands/__init__.py +0 -0
- wagtailstreamforms/management/commands/prunesubmissions.py +29 -0
- wagtailstreamforms/migrations/0001_initial.py +555 -0
- wagtailstreamforms/migrations/0002_form_site.py +21 -0
- wagtailstreamforms/migrations/0003_alter_form_fields.py +20 -0
- wagtailstreamforms/migrations/__init__.py +0 -0
- wagtailstreamforms/models/__init__.py +39 -0
- wagtailstreamforms/models/abstract.py +15 -0
- wagtailstreamforms/models/file.py +35 -0
- wagtailstreamforms/models/form.py +188 -0
- wagtailstreamforms/models/submission.py +27 -0
- wagtailstreamforms/serializers.py +11 -0
- wagtailstreamforms/streamfield.py +48 -0
- wagtailstreamforms/templates/streamforms/advanced_settings.html +25 -0
- wagtailstreamforms/templates/streamforms/confirm_copy.html +26 -0
- wagtailstreamforms/templates/streamforms/confirm_delete.html +23 -0
- wagtailstreamforms/templates/streamforms/form_block.html +10 -0
- wagtailstreamforms/templates/streamforms/index_submissions.html +104 -0
- wagtailstreamforms/templates/streamforms/list_submissions.html +56 -0
- wagtailstreamforms/templates/streamforms/non_existent_form.html +2 -0
- wagtailstreamforms/templates/streamforms/partials/form_field.html +6 -0
- wagtailstreamforms/templates/streamforms/partials/pagination_nav.html +17 -0
- wagtailstreamforms/templates/streamforms/wagtailadmin/shared/datetimepicker_translations.html +39 -0
- wagtailstreamforms/templatetags/__init__.py +0 -0
- wagtailstreamforms/templatetags/streamforms_tags.py +43 -0
- wagtailstreamforms/urls.py +31 -0
- wagtailstreamforms/utils/__init__.py +0 -0
- wagtailstreamforms/utils/apps.py +25 -0
- wagtailstreamforms/utils/general.py +6 -0
- wagtailstreamforms/utils/loading.py +30 -0
- wagtailstreamforms/utils/requests.py +13 -0
- wagtailstreamforms/utils/version.py +0 -0
- wagtailstreamforms/views/__init__.py +4 -0
- wagtailstreamforms/views/advanced_settings.py +51 -0
- wagtailstreamforms/views/copy.py +83 -0
- wagtailstreamforms/views/submission_delete.py +73 -0
- wagtailstreamforms/views/submission_list.py +112 -0
- wagtailstreamforms/wagtail_hooks.py +255 -0
- wagtailstreamforms/wagtailstreamforms_fields.py +274 -0
- wagtailstreamforms/wagtailstreamforms_hooks.py +31 -0
- wagtailstreamforms-0.0.0.dist-info/METADATA +24 -0
- wagtailstreamforms-0.0.0.dist-info/RECORD +58 -0
- wagtailstreamforms-0.0.0.dist-info/WHEEL +5 -0
- wagtailstreamforms-0.0.0.dist-info/licenses/LICENSE +19 -0
- wagtailstreamforms-0.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
# Generated by Django 2.0.5 on 2018-05-30 23:03
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
from wagtail import blocks
|
|
5
|
+
|
|
6
|
+
from django.db import migrations, models
|
|
7
|
+
|
|
8
|
+
import wagtailstreamforms.conf
|
|
9
|
+
import wagtailstreamforms.fields
|
|
10
|
+
import wagtailstreamforms.streamfield
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Migration(migrations.Migration):
|
|
14
|
+
initial = True
|
|
15
|
+
|
|
16
|
+
dependencies = [("wagtailcore", "0040_page_draft_title")]
|
|
17
|
+
|
|
18
|
+
operations = [
|
|
19
|
+
migrations.CreateModel(
|
|
20
|
+
name="Form",
|
|
21
|
+
fields=[
|
|
22
|
+
(
|
|
23
|
+
"id",
|
|
24
|
+
models.AutoField(
|
|
25
|
+
auto_created=True,
|
|
26
|
+
primary_key=True,
|
|
27
|
+
serialize=False,
|
|
28
|
+
verbose_name="ID",
|
|
29
|
+
),
|
|
30
|
+
),
|
|
31
|
+
("title", models.CharField(max_length=255, verbose_name="Title")),
|
|
32
|
+
(
|
|
33
|
+
"slug",
|
|
34
|
+
models.SlugField(
|
|
35
|
+
allow_unicode=True,
|
|
36
|
+
help_text="Used to identify the form in template tags",
|
|
37
|
+
max_length=255,
|
|
38
|
+
unique=True,
|
|
39
|
+
verbose_name="Slug",
|
|
40
|
+
),
|
|
41
|
+
),
|
|
42
|
+
(
|
|
43
|
+
"template_name",
|
|
44
|
+
models.CharField(
|
|
45
|
+
choices=wagtailstreamforms.conf.get_setting("FORM_TEMPLATES"),
|
|
46
|
+
max_length=255,
|
|
47
|
+
verbose_name="Template",
|
|
48
|
+
),
|
|
49
|
+
),
|
|
50
|
+
(
|
|
51
|
+
"fields",
|
|
52
|
+
wagtailstreamforms.streamfield.FormFieldsStreamField(
|
|
53
|
+
[
|
|
54
|
+
(
|
|
55
|
+
"singleline",
|
|
56
|
+
blocks.StructBlock(
|
|
57
|
+
[
|
|
58
|
+
("label", blocks.CharBlock()),
|
|
59
|
+
(
|
|
60
|
+
"help_text",
|
|
61
|
+
blocks.CharBlock(
|
|
62
|
+
required=False
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
(
|
|
66
|
+
"required",
|
|
67
|
+
blocks.BooleanBlock(
|
|
68
|
+
required=False
|
|
69
|
+
),
|
|
70
|
+
),
|
|
71
|
+
(
|
|
72
|
+
"default_value",
|
|
73
|
+
blocks.CharBlock(
|
|
74
|
+
required=False
|
|
75
|
+
),
|
|
76
|
+
),
|
|
77
|
+
],
|
|
78
|
+
icon="placeholder",
|
|
79
|
+
label="Text field (single line)",
|
|
80
|
+
),
|
|
81
|
+
),
|
|
82
|
+
(
|
|
83
|
+
"multiline",
|
|
84
|
+
blocks.StructBlock(
|
|
85
|
+
[
|
|
86
|
+
("label", blocks.CharBlock()),
|
|
87
|
+
(
|
|
88
|
+
"help_text",
|
|
89
|
+
blocks.CharBlock(
|
|
90
|
+
required=False
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
(
|
|
94
|
+
"required",
|
|
95
|
+
blocks.BooleanBlock(
|
|
96
|
+
required=False
|
|
97
|
+
),
|
|
98
|
+
),
|
|
99
|
+
(
|
|
100
|
+
"default_value",
|
|
101
|
+
blocks.CharBlock(
|
|
102
|
+
required=False
|
|
103
|
+
),
|
|
104
|
+
),
|
|
105
|
+
],
|
|
106
|
+
icon="placeholder",
|
|
107
|
+
label="Text field (multi line)",
|
|
108
|
+
),
|
|
109
|
+
),
|
|
110
|
+
(
|
|
111
|
+
"date",
|
|
112
|
+
blocks.StructBlock(
|
|
113
|
+
[
|
|
114
|
+
("label", blocks.CharBlock()),
|
|
115
|
+
(
|
|
116
|
+
"help_text",
|
|
117
|
+
blocks.CharBlock(
|
|
118
|
+
required=False
|
|
119
|
+
),
|
|
120
|
+
),
|
|
121
|
+
(
|
|
122
|
+
"required",
|
|
123
|
+
blocks.BooleanBlock(
|
|
124
|
+
required=False
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
(
|
|
128
|
+
"default_value",
|
|
129
|
+
blocks.CharBlock(
|
|
130
|
+
required=False
|
|
131
|
+
),
|
|
132
|
+
),
|
|
133
|
+
],
|
|
134
|
+
icon="date",
|
|
135
|
+
label="Date field",
|
|
136
|
+
),
|
|
137
|
+
),
|
|
138
|
+
(
|
|
139
|
+
"datetime",
|
|
140
|
+
blocks.StructBlock(
|
|
141
|
+
[
|
|
142
|
+
("label", blocks.CharBlock()),
|
|
143
|
+
(
|
|
144
|
+
"help_text",
|
|
145
|
+
blocks.CharBlock(
|
|
146
|
+
required=False
|
|
147
|
+
),
|
|
148
|
+
),
|
|
149
|
+
(
|
|
150
|
+
"required",
|
|
151
|
+
blocks.BooleanBlock(
|
|
152
|
+
required=False
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
(
|
|
156
|
+
"default_value",
|
|
157
|
+
blocks.CharBlock(
|
|
158
|
+
required=False
|
|
159
|
+
),
|
|
160
|
+
),
|
|
161
|
+
],
|
|
162
|
+
icon="time",
|
|
163
|
+
label="Time field",
|
|
164
|
+
),
|
|
165
|
+
),
|
|
166
|
+
(
|
|
167
|
+
"email",
|
|
168
|
+
blocks.StructBlock(
|
|
169
|
+
[
|
|
170
|
+
("label", blocks.CharBlock()),
|
|
171
|
+
(
|
|
172
|
+
"help_text",
|
|
173
|
+
blocks.CharBlock(
|
|
174
|
+
required=False
|
|
175
|
+
),
|
|
176
|
+
),
|
|
177
|
+
(
|
|
178
|
+
"required",
|
|
179
|
+
blocks.BooleanBlock(
|
|
180
|
+
required=False
|
|
181
|
+
),
|
|
182
|
+
),
|
|
183
|
+
(
|
|
184
|
+
"default_value",
|
|
185
|
+
blocks.CharBlock(
|
|
186
|
+
required=False
|
|
187
|
+
),
|
|
188
|
+
),
|
|
189
|
+
],
|
|
190
|
+
icon="mail",
|
|
191
|
+
label="Email field",
|
|
192
|
+
),
|
|
193
|
+
),
|
|
194
|
+
(
|
|
195
|
+
"url",
|
|
196
|
+
blocks.StructBlock(
|
|
197
|
+
[
|
|
198
|
+
("label", blocks.CharBlock()),
|
|
199
|
+
(
|
|
200
|
+
"help_text",
|
|
201
|
+
blocks.CharBlock(
|
|
202
|
+
required=False
|
|
203
|
+
),
|
|
204
|
+
),
|
|
205
|
+
(
|
|
206
|
+
"required",
|
|
207
|
+
blocks.BooleanBlock(
|
|
208
|
+
required=False
|
|
209
|
+
),
|
|
210
|
+
),
|
|
211
|
+
(
|
|
212
|
+
"default_value",
|
|
213
|
+
blocks.CharBlock(
|
|
214
|
+
required=False
|
|
215
|
+
),
|
|
216
|
+
),
|
|
217
|
+
],
|
|
218
|
+
icon="link",
|
|
219
|
+
label="URL field",
|
|
220
|
+
),
|
|
221
|
+
),
|
|
222
|
+
(
|
|
223
|
+
"number",
|
|
224
|
+
blocks.StructBlock(
|
|
225
|
+
[
|
|
226
|
+
("label", blocks.CharBlock()),
|
|
227
|
+
(
|
|
228
|
+
"help_text",
|
|
229
|
+
blocks.CharBlock(
|
|
230
|
+
required=False
|
|
231
|
+
),
|
|
232
|
+
),
|
|
233
|
+
(
|
|
234
|
+
"required",
|
|
235
|
+
blocks.BooleanBlock(
|
|
236
|
+
required=False
|
|
237
|
+
),
|
|
238
|
+
),
|
|
239
|
+
(
|
|
240
|
+
"default_value",
|
|
241
|
+
blocks.CharBlock(
|
|
242
|
+
required=False
|
|
243
|
+
),
|
|
244
|
+
),
|
|
245
|
+
],
|
|
246
|
+
icon="placeholder",
|
|
247
|
+
label="Number field",
|
|
248
|
+
),
|
|
249
|
+
),
|
|
250
|
+
(
|
|
251
|
+
"dropdown",
|
|
252
|
+
blocks.StructBlock(
|
|
253
|
+
[
|
|
254
|
+
("label", blocks.CharBlock()),
|
|
255
|
+
(
|
|
256
|
+
"help_text",
|
|
257
|
+
blocks.CharBlock(
|
|
258
|
+
required=False
|
|
259
|
+
),
|
|
260
|
+
),
|
|
261
|
+
(
|
|
262
|
+
"required",
|
|
263
|
+
blocks.BooleanBlock(
|
|
264
|
+
required=False
|
|
265
|
+
),
|
|
266
|
+
),
|
|
267
|
+
(
|
|
268
|
+
"empty_label",
|
|
269
|
+
blocks.CharBlock(
|
|
270
|
+
required=False
|
|
271
|
+
),
|
|
272
|
+
),
|
|
273
|
+
(
|
|
274
|
+
"choices",
|
|
275
|
+
blocks.ListBlock(
|
|
276
|
+
blocks.CharBlock(
|
|
277
|
+
label="Option"
|
|
278
|
+
)
|
|
279
|
+
),
|
|
280
|
+
),
|
|
281
|
+
],
|
|
282
|
+
icon="arrow-down-big",
|
|
283
|
+
label="Dropdown field",
|
|
284
|
+
),
|
|
285
|
+
),
|
|
286
|
+
(
|
|
287
|
+
"radio",
|
|
288
|
+
blocks.StructBlock(
|
|
289
|
+
[
|
|
290
|
+
("label", blocks.CharBlock()),
|
|
291
|
+
(
|
|
292
|
+
"help_text",
|
|
293
|
+
blocks.CharBlock(
|
|
294
|
+
required=False
|
|
295
|
+
),
|
|
296
|
+
),
|
|
297
|
+
(
|
|
298
|
+
"required",
|
|
299
|
+
blocks.BooleanBlock(
|
|
300
|
+
required=False
|
|
301
|
+
),
|
|
302
|
+
),
|
|
303
|
+
(
|
|
304
|
+
"choices",
|
|
305
|
+
blocks.ListBlock(
|
|
306
|
+
blocks.CharBlock(
|
|
307
|
+
label="Option"
|
|
308
|
+
)
|
|
309
|
+
),
|
|
310
|
+
),
|
|
311
|
+
],
|
|
312
|
+
icon="radio-empty",
|
|
313
|
+
label="Radio buttons",
|
|
314
|
+
),
|
|
315
|
+
),
|
|
316
|
+
(
|
|
317
|
+
"checkboxes",
|
|
318
|
+
blocks.StructBlock(
|
|
319
|
+
[
|
|
320
|
+
("label", blocks.CharBlock()),
|
|
321
|
+
(
|
|
322
|
+
"help_text",
|
|
323
|
+
blocks.CharBlock(
|
|
324
|
+
required=False
|
|
325
|
+
),
|
|
326
|
+
),
|
|
327
|
+
(
|
|
328
|
+
"required",
|
|
329
|
+
blocks.BooleanBlock(
|
|
330
|
+
required=False
|
|
331
|
+
),
|
|
332
|
+
),
|
|
333
|
+
(
|
|
334
|
+
"choices",
|
|
335
|
+
blocks.ListBlock(
|
|
336
|
+
blocks.CharBlock(
|
|
337
|
+
label="Option"
|
|
338
|
+
)
|
|
339
|
+
),
|
|
340
|
+
),
|
|
341
|
+
],
|
|
342
|
+
icon="tick-inverse",
|
|
343
|
+
label="Checkboxes",
|
|
344
|
+
),
|
|
345
|
+
),
|
|
346
|
+
(
|
|
347
|
+
"checkbox",
|
|
348
|
+
blocks.StructBlock(
|
|
349
|
+
[
|
|
350
|
+
("label", blocks.CharBlock()),
|
|
351
|
+
(
|
|
352
|
+
"help_text",
|
|
353
|
+
blocks.CharBlock(
|
|
354
|
+
required=False
|
|
355
|
+
),
|
|
356
|
+
),
|
|
357
|
+
(
|
|
358
|
+
"required",
|
|
359
|
+
blocks.BooleanBlock(
|
|
360
|
+
required=False
|
|
361
|
+
),
|
|
362
|
+
),
|
|
363
|
+
],
|
|
364
|
+
icon="tick-inverse",
|
|
365
|
+
label="Checkbox field",
|
|
366
|
+
),
|
|
367
|
+
),
|
|
368
|
+
(
|
|
369
|
+
"hidden",
|
|
370
|
+
blocks.StructBlock(
|
|
371
|
+
[
|
|
372
|
+
("label", blocks.CharBlock()),
|
|
373
|
+
(
|
|
374
|
+
"help_text",
|
|
375
|
+
blocks.CharBlock(
|
|
376
|
+
required=False
|
|
377
|
+
),
|
|
378
|
+
),
|
|
379
|
+
(
|
|
380
|
+
"required",
|
|
381
|
+
blocks.BooleanBlock(
|
|
382
|
+
required=False
|
|
383
|
+
),
|
|
384
|
+
),
|
|
385
|
+
(
|
|
386
|
+
"default_value",
|
|
387
|
+
blocks.CharBlock(
|
|
388
|
+
required=False
|
|
389
|
+
),
|
|
390
|
+
),
|
|
391
|
+
],
|
|
392
|
+
icon="no-view",
|
|
393
|
+
label="Hidden field",
|
|
394
|
+
),
|
|
395
|
+
),
|
|
396
|
+
(
|
|
397
|
+
"singlefile",
|
|
398
|
+
blocks.StructBlock(
|
|
399
|
+
[
|
|
400
|
+
("label", blocks.CharBlock()),
|
|
401
|
+
(
|
|
402
|
+
"help_text",
|
|
403
|
+
blocks.CharBlock(
|
|
404
|
+
required=False
|
|
405
|
+
),
|
|
406
|
+
),
|
|
407
|
+
(
|
|
408
|
+
"required",
|
|
409
|
+
blocks.BooleanBlock(
|
|
410
|
+
required=False
|
|
411
|
+
),
|
|
412
|
+
),
|
|
413
|
+
],
|
|
414
|
+
icon="doc-full-inverse",
|
|
415
|
+
label="File field",
|
|
416
|
+
),
|
|
417
|
+
),
|
|
418
|
+
(
|
|
419
|
+
"multifile",
|
|
420
|
+
blocks.StructBlock(
|
|
421
|
+
[
|
|
422
|
+
("label", blocks.CharBlock()),
|
|
423
|
+
(
|
|
424
|
+
"help_text",
|
|
425
|
+
blocks.CharBlock(
|
|
426
|
+
required=False
|
|
427
|
+
),
|
|
428
|
+
),
|
|
429
|
+
(
|
|
430
|
+
"required",
|
|
431
|
+
blocks.BooleanBlock(
|
|
432
|
+
required=False
|
|
433
|
+
),
|
|
434
|
+
),
|
|
435
|
+
],
|
|
436
|
+
icon="doc-full-inverse",
|
|
437
|
+
label="Files field",
|
|
438
|
+
),
|
|
439
|
+
),
|
|
440
|
+
],
|
|
441
|
+
verbose_name="Fields",
|
|
442
|
+
),
|
|
443
|
+
),
|
|
444
|
+
(
|
|
445
|
+
"submit_button_text",
|
|
446
|
+
models.CharField(
|
|
447
|
+
default="Submit",
|
|
448
|
+
max_length=100,
|
|
449
|
+
verbose_name="Submit button text",
|
|
450
|
+
),
|
|
451
|
+
),
|
|
452
|
+
(
|
|
453
|
+
"success_message",
|
|
454
|
+
models.CharField(
|
|
455
|
+
blank=True,
|
|
456
|
+
help_text="An optional success message to show when the form has been successfully submitted",
|
|
457
|
+
max_length=255,
|
|
458
|
+
verbose_name="Success message",
|
|
459
|
+
),
|
|
460
|
+
),
|
|
461
|
+
(
|
|
462
|
+
"error_message",
|
|
463
|
+
models.CharField(
|
|
464
|
+
blank=True,
|
|
465
|
+
help_text="An optional error message to show when the form has validation errors",
|
|
466
|
+
max_length=255,
|
|
467
|
+
verbose_name="Error message",
|
|
468
|
+
),
|
|
469
|
+
),
|
|
470
|
+
(
|
|
471
|
+
"process_form_submission_hooks",
|
|
472
|
+
wagtailstreamforms.fields.HookSelectField(
|
|
473
|
+
blank=True, verbose_name="Submission hooks"
|
|
474
|
+
),
|
|
475
|
+
),
|
|
476
|
+
(
|
|
477
|
+
"post_redirect_page",
|
|
478
|
+
models.ForeignKey(
|
|
479
|
+
blank=True,
|
|
480
|
+
help_text="The page to redirect to after a successful submission",
|
|
481
|
+
null=True,
|
|
482
|
+
on_delete=django.db.models.deletion.SET_NULL,
|
|
483
|
+
related_name="+",
|
|
484
|
+
to="wagtailcore.Page",
|
|
485
|
+
verbose_name="Post redirect page",
|
|
486
|
+
),
|
|
487
|
+
),
|
|
488
|
+
],
|
|
489
|
+
options={
|
|
490
|
+
"verbose_name": "Form",
|
|
491
|
+
"verbose_name_plural": "Forms",
|
|
492
|
+
"ordering": ["title"],
|
|
493
|
+
},
|
|
494
|
+
),
|
|
495
|
+
migrations.CreateModel(
|
|
496
|
+
name="FormSubmission",
|
|
497
|
+
fields=[
|
|
498
|
+
(
|
|
499
|
+
"id",
|
|
500
|
+
models.AutoField(
|
|
501
|
+
auto_created=True,
|
|
502
|
+
primary_key=True,
|
|
503
|
+
serialize=False,
|
|
504
|
+
verbose_name="ID",
|
|
505
|
+
),
|
|
506
|
+
),
|
|
507
|
+
("form_data", models.TextField(verbose_name="Form data")),
|
|
508
|
+
(
|
|
509
|
+
"submit_time",
|
|
510
|
+
models.DateTimeField(auto_now_add=True, verbose_name="Submit time"),
|
|
511
|
+
),
|
|
512
|
+
(
|
|
513
|
+
"form",
|
|
514
|
+
models.ForeignKey(
|
|
515
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
516
|
+
to="wagtailstreamforms.Form",
|
|
517
|
+
verbose_name="Form",
|
|
518
|
+
),
|
|
519
|
+
),
|
|
520
|
+
],
|
|
521
|
+
options={"verbose_name": "Form submission", "ordering": ["-submit_time"]},
|
|
522
|
+
),
|
|
523
|
+
migrations.CreateModel(
|
|
524
|
+
name="FormSubmissionFile",
|
|
525
|
+
fields=[
|
|
526
|
+
(
|
|
527
|
+
"id",
|
|
528
|
+
models.AutoField(
|
|
529
|
+
auto_created=True,
|
|
530
|
+
primary_key=True,
|
|
531
|
+
serialize=False,
|
|
532
|
+
verbose_name="ID",
|
|
533
|
+
),
|
|
534
|
+
),
|
|
535
|
+
("field", models.CharField(max_length=255, verbose_name="Field")),
|
|
536
|
+
(
|
|
537
|
+
"file",
|
|
538
|
+
models.FileField(upload_to="streamforms/", verbose_name="File"),
|
|
539
|
+
),
|
|
540
|
+
(
|
|
541
|
+
"submission",
|
|
542
|
+
models.ForeignKey(
|
|
543
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
544
|
+
related_name="files",
|
|
545
|
+
to="wagtailstreamforms.FormSubmission",
|
|
546
|
+
verbose_name="Submission",
|
|
547
|
+
),
|
|
548
|
+
),
|
|
549
|
+
],
|
|
550
|
+
options={
|
|
551
|
+
"verbose_name": "Form submission file",
|
|
552
|
+
"ordering": ["field", "file"],
|
|
553
|
+
},
|
|
554
|
+
),
|
|
555
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Generated by Django 2.2.6 on 2019-11-22 10:27
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [("wagtailstreamforms", "0001_initial")]
|
|
9
|
+
|
|
10
|
+
operations = [
|
|
11
|
+
migrations.AddField(
|
|
12
|
+
model_name="form",
|
|
13
|
+
name="site",
|
|
14
|
+
field=models.ForeignKey(
|
|
15
|
+
blank=True,
|
|
16
|
+
null=True,
|
|
17
|
+
on_delete=django.db.models.deletion.SET_NULL,
|
|
18
|
+
to="wagtailcore.Site",
|
|
19
|
+
),
|
|
20
|
+
)
|
|
21
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Generated by Django 4.1.8 on 2023-04-14 05:21
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
import wagtail.blocks
|
|
5
|
+
import wagtailstreamforms.streamfield
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Migration(migrations.Migration):
|
|
9
|
+
|
|
10
|
+
dependencies = [
|
|
11
|
+
('wagtailstreamforms', '0002_form_site'),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
operations = [
|
|
15
|
+
migrations.AlterField(
|
|
16
|
+
model_name='form',
|
|
17
|
+
name='fields',
|
|
18
|
+
field=wagtailstreamforms.streamfield.FormFieldsStreamField([('singleline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('default_value', wagtail.blocks.CharBlock(required=False))], icon='placeholder', label='Text field (single line)')), ('multiline', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('default_value', wagtail.blocks.CharBlock(required=False))], icon='placeholder', label='Text field (multi line)')), ('date', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('default_value', wagtail.blocks.CharBlock(required=False))], icon='date', label='Date field')), ('datetime', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('default_value', wagtail.blocks.CharBlock(required=False))], icon='time', label='Time field')), ('email', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('default_value', wagtail.blocks.CharBlock(required=False))], icon='mail', label='Email field')), ('url', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('default_value', wagtail.blocks.CharBlock(required=False))], icon='link', label='URL field')), ('number', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('default_value', wagtail.blocks.CharBlock(required=False))], icon='placeholder', label='Number field')), ('dropdown', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('empty_label', wagtail.blocks.CharBlock(required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Option')))], icon='arrow-down-big', label='Dropdown field')), ('radio', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Option')))], icon='radio-empty', label='Radio buttons')), ('checkboxes', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('choices', wagtail.blocks.ListBlock(wagtail.blocks.CharBlock(label='Option')))], icon='tick-inverse', label='Checkboxes')), ('checkbox', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False))], icon='tick-inverse', label='Checkbox field')), ('hidden', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False)), ('default_value', wagtail.blocks.CharBlock(required=False))], icon='no-view', label='Hidden field')), ('singlefile', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False))], icon='doc-full-inverse', label='File field')), ('multifile', wagtail.blocks.StructBlock([('label', wagtail.blocks.CharBlock()), ('help_text', wagtail.blocks.CharBlock(required=False)), ('required', wagtail.blocks.BooleanBlock(required=False))], icon='doc-full-inverse', label='Files field'))], use_json_field=True, verbose_name='Fields'),
|
|
19
|
+
),
|
|
20
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from django.conf import settings
|
|
2
|
+
from django.core.exceptions import ImproperlyConfigured
|
|
3
|
+
|
|
4
|
+
from .abstract import AbstractFormSetting # noqa
|
|
5
|
+
from .file import FormSubmissionFile # noqa
|
|
6
|
+
from .form import Form # noqa
|
|
7
|
+
from .submission import FormSubmission # noqa
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_form_model_string():
|
|
11
|
+
"""
|
|
12
|
+
Get the dotted ``app.Model`` name for the form model as a string.
|
|
13
|
+
Useful for developers making Wagtail plugins that need to refer to the
|
|
14
|
+
form model, such as in foreign keys, but the model itself is not required.
|
|
15
|
+
"""
|
|
16
|
+
return getattr(settings, "WAGTAILSTREAMFORMS_FORM_MODEL", "wagtailstreamforms.Form")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_form_model():
|
|
20
|
+
"""
|
|
21
|
+
Get the form model from the ``WAGTAILSTREAMFORMS_FORM_MODEL`` setting.
|
|
22
|
+
Useful for developers making Wagtail plugins that need the form model.
|
|
23
|
+
Defaults to the standard :class:`~wagtailstreamforms.Form` model
|
|
24
|
+
if no custom model is defined.
|
|
25
|
+
"""
|
|
26
|
+
from django.apps import apps
|
|
27
|
+
|
|
28
|
+
model_string = get_form_model_string()
|
|
29
|
+
try:
|
|
30
|
+
return apps.get_model(model_string)
|
|
31
|
+
except ValueError:
|
|
32
|
+
raise ImproperlyConfigured(
|
|
33
|
+
"WAGTAILSTREAMFORMS_FORM_MODEL must be of the form 'app_label.model_name'"
|
|
34
|
+
)
|
|
35
|
+
except LookupError:
|
|
36
|
+
raise ImproperlyConfigured(
|
|
37
|
+
"WAGTAILSTREAMFORMS_FORM_MODEL refers to model '%s' that has not been installed"
|
|
38
|
+
% model_string
|
|
39
|
+
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AbstractFormSetting(models.Model):
|
|
5
|
+
form = models.OneToOneField(
|
|
6
|
+
"wagtailstreamforms.Form",
|
|
7
|
+
on_delete=models.CASCADE,
|
|
8
|
+
related_name="advanced_settings",
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
class Meta:
|
|
12
|
+
abstract = True
|
|
13
|
+
|
|
14
|
+
def __str__(self):
|
|
15
|
+
return self.form.title
|