Opened 9 years ago
Last modified 9 years ago
#25067 closed Bug
Allowing all characters when parsing inclusion templatetags — at Initial Version
Reported by: | Sven R. Kunze | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | inclusion_tag, parse_bits, token_kwargs |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
We use the inclusion_tag to create a special HTML DIV element with several custom attributes; basically like this:
@inclusion_tag('...') def my_tag(x, **kwargs): return { 'y': x +1, 'extra_attrs': kwargs, }
Unfortunately, django/template/base.py:token_kwargs does not recognize '-' in variable names so that extra HTML attrs such as 'data-myattr' cannot be added to the DIV.
Python as such supports special characters in kwargs.
Note:
See TracTickets
for help on using tickets.