mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #32002 -- Added headers parameter to HttpResponse and subclasses.
This commit is contained in:
parent
2e7cc95499
commit
dcb69043d0
9 changed files with 115 additions and 32 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue