Do you mean that you need the values of the completed form?
In your opinion, check if the form is valid using form.is_valid(); it fills self.cleaned_datacontaining your cleared values. Using data is not so secure without checking it first.
So:
views.py:
if request.method == 'post':
form = ContactForm(request.POST)
if form.is_valid():
form.send()
forms.py:
from django import forms
class ContactForm(forms.Form):
subject = forms.CharField(required=True)
message = forms.CharField(required=True, widget=forms.Textarea)
def send(self):
subject = self.cleaned_data['subject']
...
source
share