diff options
| author | Thomas Tanner <tanner@gmx.net> | 2014-12-20 22:14:46 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-24 12:33:57 -0500 |
| commit | b27db97b236569d059fa824c3078e06adf8b4fae (patch) | |
| tree | 3f702d1a043aaa42096d4968651d2939f0143dd6 /docs/topics/conditional-view-processing.txt | |
| parent | fae551d765bc24103ce1b9782aa264246abfa2b8 (diff) | |
Fixed #22461 -- Added if-unmodified-since support to the condition decorator.
Diffstat (limited to 'docs/topics/conditional-view-processing.txt')
| -rw-r--r-- | docs/topics/conditional-view-processing.txt | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/docs/topics/conditional-view-processing.txt b/docs/topics/conditional-view-processing.txt index 83b454a4aa..77080266de 100644 --- a/docs/topics/conditional-view-processing.txt +++ b/docs/topics/conditional-view-processing.txt @@ -15,18 +15,29 @@ or you can rely on the :class:`~django.middleware.common.CommonMiddleware` middleware to set the ``ETag`` header. When the client next requests the same resource, it might send along a header -such as `If-modified-since`_, containing the date of the last modification -time it was sent, or `If-none-match`_, containing the ``ETag`` it was sent. +such as either `If-modified-since`_ or `If-unmodified-since`_, containing the +date of the last modification time it was sent, or either `If-match`_ or +`If-none-match`_, containing the last ``ETag`` it was sent. If the current version of the page matches the ``ETag`` sent by the client, or if the resource has not been modified, a 304 status code can be sent back, instead of a full response, telling the client that nothing has changed. +Depending on the header, if the page has been modified or does not match the +``ETag`` sent by the client, a 412 status code (Precondition Failed) may be +returned. +.. _If-match: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24 .. _If-none-match: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26 .. _If-modified-since: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25 +.. _If-unmodified-since: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.28 When you need more fine-grained control you may use per-view conditional processing functions. +.. versionchanged:: 1.8 + + Support for the ``If-unmodified-since`` header was added to conditional + view processing. + .. _conditional-decorators: The ``condition`` decorator @@ -194,4 +205,3 @@ view takes a while to generate the content, you should consider using the fairly quickly, stick to using the middleware and the amount of network traffic sent back to the clients will still be reduced if the view hasn't changed. - |
