Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update chapter07.rst

For the example to work, you have to use {% csrf_token %} and additional imports in views.py
  • Loading branch information...
commit 26d38a44b8cc477962cc8bbebc564aed44ba195e 1 parent 8b4a275
@Lapin-Blanc Lapin-Blanc authored unknown committed
Showing with 3 additions and 0 deletions.
  1. +3 −0  chapter07.rst
View
3  chapter07.rst
@@ -959,6 +959,8 @@ Here's how we can rewrite ``contact()`` to use the forms framework::
from django.shortcuts import render
from mysite.contact.forms import ContactForm
+ from django.http import HttpResponseRedirect
+ from django.core.mail import send_mail
def contact(request):
if request.method == 'POST':
@@ -995,6 +997,7 @@ Here's how we can rewrite ``contact()`` to use the forms framework::
<table>
{{ form.as_table }}
</table>
+ {% csrf_token %}
<input type="submit" value="Submit">
</form>
</body>
Please sign in to comment.
Something went wrong with that request. Please try again.