diff options
| author | Kevin Christopher Henry <k@severian.com> | 2016-10-13 19:52:18 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-10-14 07:36:01 -0400 |
| commit | 9eb49af821546af1cae8f3a91aefea4b99a6478f (patch) | |
| tree | 84b74d4de84d44e156e44837f6da34d8628f9dc5 /docs/topics/conditional-view-processing.txt | |
| parent | 4cfccc713a8ff91a0d523d74d8b557e89468e84b (diff) | |
Refs #19705 -- Documented decorator ordering with @condition().
Diffstat (limited to 'docs/topics/conditional-view-processing.txt')
| -rw-r--r-- | docs/topics/conditional-view-processing.txt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/topics/conditional-view-processing.txt b/docs/topics/conditional-view-processing.txt index 7f1fde0fb9..7fabacf6c5 100644 --- a/docs/topics/conditional-view-processing.txt +++ b/docs/topics/conditional-view-processing.txt @@ -105,6 +105,18 @@ for your front page view:: def front_page(request, blog_id): ... +.. admonition:: Be careful with the order of decorators + + When ``condition()`` returns a conditional response, any decorators below + it will be skipped and won't apply to the response. Therefore, any + decorators that need to apply to both the regular view response and a + conditional response must be above ``condition()``. In particular, + :func:`~django.views.decorators.vary.vary_on_cookie`, + :func:`~django.views.decorators.vary.vary_on_headers`, and + :func:`~django.views.decorators.cache.cache_control` should come first + because :rfc:`RFC 7232 <7232#section-4.1>` requires that the headers they + set be present on 304 responses. + Shortcuts for only computing one value ====================================== |
