10.1. Forms About
10.1.1. Simple "contact us" form
{{ form.as_table }}
will render them as table cells wrapped in<tr>
tags{{ form.as_p }}
will render them wrapped in<p>
tags{{ form.as_ul }}
will render them wrapped in<li>
tags
class ContactUsForm(forms.Form):
sender = forms.EmailField()
subject = forms.CharField()
body = forms.CharField(widget=forms.Textarea)
class ContactUsView(FormView):
template_name = 'addressbook/contact-form.html'
form_class = ContactUsForm
success_url = '/thank-you.html'
class ThankYouView(TemplateView):
template_name = 'addressbook/thank-you.html'