mirror of https://github.com/django/django.git
Fixed #23825 -- Added links for decorating class-based views to the CSRF docs.
This commit is contained in:
parent
1ed9b9e2e2
commit
fa680ce1e2
|
@ -205,6 +205,9 @@ both is fine, and will incur minimal overhead.
|
||||||
# ...
|
# ...
|
||||||
return render(request, "a_template.html", c)
|
return render(request, "a_template.html", c)
|
||||||
|
|
||||||
|
If you are using class-based views, you can refer to
|
||||||
|
:ref:`Decorating class-based views<decorating-class-based-views>`.
|
||||||
|
|
||||||
Rejected requests
|
Rejected requests
|
||||||
=================
|
=================
|
||||||
|
|
||||||
|
@ -283,8 +286,10 @@ will require a CSRF token to be inserted you should use the
|
||||||
@cache_page(60 * 15)
|
@cache_page(60 * 15)
|
||||||
@csrf_protect
|
@csrf_protect
|
||||||
def my_view(request):
|
def my_view(request):
|
||||||
# ...
|
...
|
||||||
|
|
||||||
|
If you are using class-based views, you can refer to :ref:`Decorating
|
||||||
|
class-based views<decorating-class-based-views>`.
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
=======
|
=======
|
||||||
|
@ -327,6 +332,10 @@ section.
|
||||||
Utilities
|
Utilities
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
The examples below assume you are using function-based views. If you
|
||||||
|
are working with class-based views, you can refer to :ref:`Decorating
|
||||||
|
class-based views<decorating-class-based-views>`.
|
||||||
|
|
||||||
.. function:: csrf_exempt(view)
|
.. function:: csrf_exempt(view)
|
||||||
|
|
||||||
This decorator marks a view as being exempt from the protection ensured by
|
This decorator marks a view as being exempt from the protection ensured by
|
||||||
|
|
Loading…
Reference in New Issue