summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorTom Carrick <tom@carrick.eu>2020-09-15 12:43:37 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-10-07 09:19:57 +0200
commitdcb69043d0de45bb55998fc418d93c28bc7689ae (patch)
treeac58b959d8b749965841721e6cc2a58784bb51c3 /docs/topics
parent2e7cc95499f758a1c4aa036cbf1dcddf82a89ea2 (diff)
Fixed #32002 -- Added headers parameter to HttpResponse and subclasses.
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/class-based-views/index.txt7
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/topics/class-based-views/index.txt b/docs/topics/class-based-views/index.txt
index 8874545469..01f9c35460 100644
--- a/docs/topics/class-based-views/index.txt
+++ b/docs/topics/class-based-views/index.txt
@@ -117,9 +117,10 @@ And the view::
def head(self, *args, **kwargs):
last_book = self.get_queryset().latest('publication_date')
- response = HttpResponse()
- # RFC 1123 date format
- response.headers['Last-Modified'] = last_book.publication_date.strftime('%a, %d %b %Y %H:%M:%S GMT')
+ response = HttpResponse(
+ # RFC 1123 date format.
+ headers={'Last-Modified': last_book.publication_date.strftime('%a, %d %b %Y %H:%M:%S GMT')},
+ )
return response
If the view is accessed from a ``GET`` request, an object list is returned in