Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def contact(request):
- if request.method == 'POST': # If the form has been submitted...
- # ContactForm was defined in the previous section
- form = ContactForm(request.POST) # A form bound to the POST data
- if form.is_valid(): # All validation rules pass
- # Process the data in form.cleaned_data
- # ...
- return HttpResponseRedirect('/thanks/') # Redirect after POST
- else:
- form = ContactForm() # An unbound form
- return render(request, 'contact.html', {
- 'form': form,
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement