I have to prepare a url on the fly in the template by passing some variables to it.
{% with init_sync_url='/baseurl/formid/'|add:form_id|add:'/context/' %}
=={{init_sync_url}}===
{% myother_tag goto_url=init_sync_url %}
{% endwith %}
This code works pretty fine. Which also shows me the output on the template:
==/baseurl/formid/abcd123/context/===
Which is OK. But after that when I add the a context variable cntxt
containing a string like - '01-01-1030'
{% with init_sync_url='/baseurl/formid/'|add:form_id|add:'/context/'|add:cntxt %}
{% myother_tag goto_url=init_sync_url %}
{% endwith %}
OR
{% with init_sync_url='/baseurl/formid/'|add:form_id|add:'/context/' %}
{% myother_tag goto_url=init_sync_url|add:cntxt %}
{% endwith %}
This throws an error!!! Don't know, why?
I expect the output if I log the line in the template inside with
tag
=={{init_sync_url}}===
:
==/baseurl/formid/abcd123/context/01-01-1030===
- Is the hyphen("-") causing something?
(Detailed error in pastebin)
NOTE - Just In case if any django developer knows the answer to my question. There is not much difference in the filters
of django
& Chicagoboss
.