diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-09-21 06:28:28 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-09-21 09:28:30 +0200 |
| commit | f426df268bdd4dda8178bf79f50e635f063e6f78 (patch) | |
| tree | e43f44291b58b1db8039aa900bdbc38829a1460e | |
| parent | a077f10df477880a23faad333aae8d9ef8738152 (diff) | |
[4.0.x] Used :rfc: role in docs/topics/conditional-view-processing.txt.
Backport of f8bab4e0dcdad5cb174998e1b31d74c8434a2477 from main
| -rw-r--r-- | docs/topics/conditional-view-processing.txt | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/docs/topics/conditional-view-processing.txt b/docs/topics/conditional-view-processing.txt index fc589cf288..ed2c7f8363 100644 --- a/docs/topics/conditional-view-processing.txt +++ b/docs/topics/conditional-view-processing.txt @@ -34,14 +34,12 @@ processing functions. The ``condition`` decorator =========================== -Sometimes (in fact, quite often) you can create functions to rapidly compute the ETag_ -value or the last-modified time for a resource, **without** needing to do all -the computations needed to construct the full view. Django can then use these -functions to provide an "early bailout" option for the view processing. -Telling the client that the content has not been modified since the last -request, perhaps. - -.. _ETag: https://tools.ietf.org/html/rfc7232#section-2.3 +Sometimes (in fact, quite often) you can create functions to rapidly compute +the :rfc:`ETag <7232#section-2.3>` value or the last-modified time for a +resource, **without** needing to do all the computations needed to construct +the full view. Django can then use these functions to provide an +"early bailout" option for the view processing. Telling the client that the +content has not been modified since the last request, perhaps. These two functions are passed as parameters to the ``django.views.decorators.http.condition`` decorator. This decorator uses @@ -60,7 +58,8 @@ order, as the view function they are helping to wrap. The function passed ``last_modified_func`` should return a standard datetime value specifying the last time the resource was modified, or ``None`` if the resource doesn't exist. The function passed to the ``etag`` decorator should return a string -representing the `ETag`_ for the resource, or ``None`` if it doesn't exist. +representing the :rfc:`ETag <7232#section-2.3>` for the resource, or ``None`` +if it doesn't exist. The decorator sets the ``ETag`` and ``Last-Modified`` headers on the response if they are not already set by the view and if the request's method is safe |
