Hi,
I am trying to use the url tag on some parameters, one of which needs to come from a function.
For example as follows:
{% with state_url=encode_url flow.state.description %}
<a href="{% url 'advance-flow' flow.id state_url %}">advance</a>
encode_url is defined as follows:
@register.simple_tag
def encode_url(link_text):
return link_text.replace(' ', '_')
This causes an error on the with statement:
Request Method: GET
Request URL: http://127.0.0.1:8000/list_flows/
Django Version: 1.7
Exception Type: TemplateSyntaxError
Exception Value:
'with' received an invalid token: 'flow.state.description'
I'm guessing that you cannot put another template tag in the "with" statement. I cannot see a way around this. Any ideas?
Thanks
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9a93cbaf-0f47-41d5-9eea-e6d3297caeac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment