I am setting up a template in which I would like the default value to be a combination of a constant string and a variable value. The desired HTML output would look something like this:
<span id="id1234" class="foo"> Click <a href="/images/img1234.jpg">here to view image</a>. </span>
In the template code for span I would like something like:
<span id="{{ spanid|default:'id'object.id }}" class="foo">
Similarly, the a tag will use:
<a href="/images/{{ image_file|default:'img'object.id'.jpg'"> here to view...
This does not work, is there a way to do this in the syntax of the django templates and the default filter?
source share