Changed an example in CSRF docs to use new 'render' shortcut
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16186 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ae1866ddef
commit
1d350a6c51
|
@ -134,14 +134,13 @@ data. (These are often the same view function, but not always). It is used like
|
||||||
this::
|
this::
|
||||||
|
|
||||||
from django.views.decorators.csrf import csrf_protect
|
from django.views.decorators.csrf import csrf_protect
|
||||||
from django.template import RequestContext
|
from django.shortcuts import render
|
||||||
|
|
||||||
@csrf_protect
|
@csrf_protect
|
||||||
def my_view(request):
|
def my_view(request):
|
||||||
c = {}
|
c = {}
|
||||||
# ...
|
# ...
|
||||||
return render_to_response("a_template.html", c,
|
return render(request, "a_template.html", c)
|
||||||
context_instance=RequestContext(request))
|
|
||||||
|
|
||||||
Use of the decorator is **not recommended** by itself, since if you forget to
|
Use of the decorator is **not recommended** by itself, since if you forget to
|
||||||
use it, you will have a security hole. The 'belt and braces' strategy of using
|
use it, you will have a security hole. The 'belt and braces' strategy of using
|
||||||
|
|
Loading…
Reference in New Issue