11.3 Creating the Contact Webpage

It’s time to build a webpage. To start, we build a contact form, which prompts the user for information and then sends that information to us via email. We then build a view and URL pattern to interact with the form, saving the actual templates of the page for last.

The following process for building a data-processing webpage is reproduced for convenience from Chapter 9: Controlling Forms in Views, Section 9.5.

1. Create a form class that inherits ModelForm.

2. Implement any necessary clean functions for the fields of the form.

3. Create a CBV with get() and post() methods exactly as detailed in the chapter, making sure to specify any desirable attributes (form_class, model, and template_name, being the most ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.