11.3.1 Contact Form
The goal of the contact page is to enable users to give us feedback on our site. To that end, we want to present users with a form that allows them to write feedback and gives us a way to contact them in the event they want us to. Without a model, we need to build the form as a Form
(Example 11.5) instead of as a ModelForm
as we did previously.
contact/forms.py
in 3969d84738
1 from django import forms . ... 6 class ContactForm(forms.Form): . ... 18 email = forms.EmailField( 19 initial='youremail@domain.com') 20 text = forms.CharField(widget=forms.Textarea)
By default, a forms.CharField
(as opposed to models.CharField
) presents ...
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.