Refs #31949 -- Made http decorators to work with async functions.

This commit is contained in:
th3nn3ss 2023-04-11 12:40:55 +01:00 committed by Mariusz Felisiak
parent cd4c4c1905
commit 3152f9de47
5 changed files with 180 additions and 19 deletions

View file

@ -84,6 +84,13 @@ view functions:
* :func:`~django.views.decorators.cache.cache_control`
* :func:`~django.views.decorators.cache.never_cache`
* :func:`~django.views.decorators.common.no_append_slash`
* :func:`~django.views.decorators.http.condition`
* :func:`~django.views.decorators.http.etag`
* :func:`~django.views.decorators.http.last_modified`
* :func:`~django.views.decorators.http.require_http_methods`
* :func:`~django.views.decorators.http.require_GET`
* :func:`~django.views.decorators.http.require_POST`
* :func:`~django.views.decorators.http.require_safe`
* ``xframe_options_deny()``
* ``xframe_options_sameorigin()``
* ``xframe_options_exempt()``

View file

@ -33,14 +33,26 @@ a :class:`django.http.HttpResponseNotAllowed` if the conditions are not met.
Note that request methods should be in uppercase.
.. versionchanged:: 5.0
Support for wrapping asynchronous view functions was added.
.. function:: require_GET()
Decorator to require that a view only accepts the GET method.
.. versionchanged:: 5.0
Support for wrapping asynchronous view functions was added.
.. function:: require_POST()
Decorator to require that a view only accepts the POST method.
.. versionchanged:: 5.0
Support for wrapping asynchronous view functions was added.
.. function:: require_safe()
Decorator to require that a view only accepts the GET and HEAD methods.
@ -55,6 +67,10 @@ a :class:`django.http.HttpResponseNotAllowed` if the conditions are not met.
such as link checkers, rely on HEAD requests, you might prefer
using ``require_safe`` instead of ``require_GET``.
.. versionchanged:: 5.0
Support for wrapping asynchronous view functions was added.
Conditional view processing
===========================
@ -71,6 +87,10 @@ control caching behavior on particular views.
headers; see
:doc:`conditional view processing </topics/conditional-view-processing>`.
.. versionchanged:: 5.0
Support for wrapping asynchronous view functions was added.
.. module:: django.views.decorators.gzip
GZip compression