mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #30310 -- Added support for looking up HttpHeaders.headers using underscores.
This commit is contained in:
@@ -199,6 +199,15 @@ All attributes should be considered read-only, unless stated otherwise.
|
||||
>>> request.headers.get('user-agent')
|
||||
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6)
|
||||
|
||||
For use in, for example, Django templates, headers can also be looked up
|
||||
using underscores in place of hyphens::
|
||||
|
||||
{{ request.headers.user_agent }}
|
||||
|
||||
.. versionchanged:: 3.0
|
||||
|
||||
Support for look ups using underscores was added.
|
||||
|
||||
.. attribute:: HttpRequest.resolver_match
|
||||
|
||||
An instance of :class:`~django.urls.ResolverMatch` representing the
|
||||
|
||||
@@ -217,6 +217,9 @@ Requests and Responses
|
||||
* Allowed :class:`~django.http.HttpResponse` to be initialized with
|
||||
:class:`memoryview` content.
|
||||
|
||||
* For use in, for example, Django templates, :attr:`.HttpRequest.headers` now
|
||||
allows look ups using underscores (e.g. ``user_agent``) in place of hyphens.
|
||||
|
||||
Serialization
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user