HamlPy
HamlPy copied to clipboard
enclose the first argument to url template tag in single quotes
With Django 1.5 we have to enclose the first argument to the url
template tag in single quotes thus HamlPy needs to recognize stuff like %a{'href':'{% url 'auth_login' %}'} login
without the need to escape the first argument's single quotes with backslashes. Right now one has to use ' as with this example %a{'href':'{% url \'auth_login\' %}'} login
in order to get <a href='{% url 'auth_login' %}'>login</a>
.
For more info see https://docs.djangoproject.com/en/dev/internals/deprecation/#id2
The url and ssi template tags will be modified so that the first argument to each tag is a template variable, not an implied string. Until then, the new-style behavior is provided in the future template tag library.
Hi Markus,
Thanks for the heads up. This issue will be tackled when HAML syntax is supported in attribute variables. I'm working on refactoring the codebase first however.
For now, a simple workaround to avoid escaping quotes is to use double quotes (e.g. %a{'href':"{% url 'auth_login' %}"}
)
Regards, Barry