Reputation: 46178
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 ?
Upvotes: 1
Views: 1334
Reputation: 5378
You can't assign firstof
to a variable like this, sadly (see this thread on django-users). You'd need to write your own custom template tag.
Upvotes: 1