From dcb69043d0de45bb55998fc418d93c28bc7689ae Mon Sep 17 00:00:00 2001 From: Tom Carrick Date: Tue, 15 Sep 2020 12:43:37 +0200 Subject: Fixed #32002 -- Added headers parameter to HttpResponse and subclasses. --- docs/topics/class-based-views/index.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs/topics') 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 -- cgit v1.3