I would like to use a firstof in a with like
<div>
{% with variable = firstof variable1 variable2 %}</div>
{{ variable }}
{% endwith %}
</div>
But of course I’m getting
u’with’ received an invalid token: u’variable1′
Is there another way to use these 2 tags together ?
You can’t assign
firstofto a variable like this, sadly (see this thread on django-users). You’d need to write your own custom template tag.