summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBen Lomax <lomax.on.the.run@gmail.com>2022-07-08 09:39:33 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-04-25 10:08:03 +0200
commit4dfc6ff8a81ed36dfc7c5b942ecab7217866b935 (patch)
tree0da6f1adf897c5db33438fd8c5b3c6c630659212 /docs
parenta14ddc8cfccbc8da6c11e1208131abc3abd6ed5d (diff)
downloaddjango-4dfc6ff8a81ed36dfc7c5b942ecab7217866b935.tar.gz
Refs #31949 -- Made @never_cache and @cache_control() decorators to work with async functions.
Thanks Carlton Gibson and Mariusz Felisiak for reviews.
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/5.0.txt4
-rw-r--r--docs/topics/async.txt25
-rw-r--r--docs/topics/http/decorators.txt8
3 files changed, 36 insertions, 1 deletions
diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt
index 3a4355588b..48df713375 100644
--- a/docs/releases/5.0.txt
+++ b/docs/releases/5.0.txt
@@ -214,7 +214,9 @@ CSRF
Decorators
~~~~~~~~~~
-* ...
+* The :func:`~django.views.decorators.cache.cache_control` and
+ :func:`~django.views.decorators.cache.never_cache` decorators now support
+ wrapping asynchronous view functions.
Email
~~~~~
diff --git a/docs/topics/async.txt b/docs/topics/async.txt
index 4b667f22a1..769fac3c52 100644
--- a/docs/topics/async.txt
+++ b/docs/topics/async.txt
@@ -73,6 +73,31 @@ from an async view, you will trigger Django's
:ref:`asynchronous safety protection <async-safety>` to protect your data from
corruption.
+Decorators
+----------
+
+.. versionadded:: 5.0
+
+The following decorators can be used with both synchronous and asynchronous
+view functions:
+
+* :func:`~django.views.decorators.cache.cache_control`
+* :func:`~django.views.decorators.cache.never_cache`
+
+For example::
+
+ from django.views.decorators.cache import never_cache
+
+
+ @never_cache
+ def my_sync_view(request):
+ ...
+
+
+ @never_cache
+ async def my_async_view(request):
+ ...
+
Queries & the ORM
-----------------
diff --git a/docs/topics/http/decorators.txt b/docs/topics/http/decorators.txt
index 3481eefb3c..4bcae64e27 100644
--- a/docs/topics/http/decorators.txt
+++ b/docs/topics/http/decorators.txt
@@ -117,6 +117,10 @@ client-side caching.
:func:`~django.utils.cache.patch_cache_control` for the details of the
transformation.
+ .. versionchanged:: 5.0
+
+ Support for wrapping asynchronous view functions was added.
+
.. function:: never_cache(view_func)
This decorator adds an ``Expires`` header to the current date/time.
@@ -127,6 +131,10 @@ client-side caching.
Each header is only added if it isn't already set.
+ .. versionchanged:: 5.0
+
+ Support for wrapping asynchronous view functions was added.
+
.. module:: django.views.decorators.common
Common