#30310: New HTTPRequest.headers not usable in templates because of hyphens
-------------------------------------+-------------------------------------
Reporter: Mark Tranchant | Owner: nobody
Type: New feature | Status: new
Component: HTTP handling | Version: 2.2
Severity: Normal | Resolution:
Keywords: request headers | Triage Stage: Accepted
hyphen template |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):
* component: Template system => HTTP handling
* type: Bug => New feature
* stage: Unreviewed => Accepted
Comment:
Hi Mark.
The default answer for the template later is to implement a filter that
will let you do the lookup with a string.
([https://stackoverflow.com/questions/8000022/django-template-how-to-look-
up-a-dictionary-value-with-a-variable StackOverflow has lots of
examples].)
Maybe we could allow this by adding a `key.replace('_', '-')` implementing
`HttpHeaders.__getitem__()`? (Probably worth seeing what a patch there
looks like anyway.)
(This instead of storing the items twice in the underlying store.)
--
Ticket URL: <https://code.djangoproject.com/ticket/30310#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/071.84953b58c41111110626a5ee47c7e45f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.