Wagtail Unboxed episode 10 4:05
Forms that work
A contact form the editor builds field by field, that emails the studio and stores every submission. And the three things Wagtail's defaults get wrong, every one measured.
What this episode covers
Submit it before writing a thank-you template and the visitor sees a 500 error, but the submission was saved and the email was sent. Refresh the thank-you page and it sends again. And an optional dropdown quietly records a choice nobody made.
What you'll learn
AbstractEmailFormandAbstractFormField: forms the editor builds- The form template, and the 403 you get without
csrf_token - The 500 that already succeeded: the missing landing template
- Why refreshing the thank-you page resubmits, and the Post/Redirect/Get fix
- Why an optional dropdown has no blank choice, and a custom
FormBuilderthat adds one - A honeypot for spam, and why it must not be type="hidden"
- Where the email goes in development
FormSubmissionsPanel: submissions and CSV export in the admin
Chapters
- 0:00 A studio you can't contact
- 0:20 Forms the editor builds
- 0:40 The template, and csrf_token
- 0:56 A 500 that already worked
- 1:11 Why the visitor sends it twice
- 1:31 Refresh sends it again
- 1:47 Post, redirect, get
- 2:08 The dropdown that lies
- 2:30 A custom FormBuilder
- 2:45 A honeypot for spam
- 3:14 Where the email goes
- 3:29 The contact form
- 3:39 The thank-you page
- 3:46 Commit and tag
- 3:50 Next episode
Versions on screen
Wagtail 7.4.3 · Django 6.1.1 · Python 3.12. Recorded on Windows; macOS and Linux commands are in the repository for every episode.