diff options
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/class-based-views/index.txt | 7 |
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 |
