Reputation: 21
I am currently developing module in which it initialize value on the basis of if/else
condition inside WITH/ENDWITH
tag of DJANGO1.9
.
Example
{%with main_value=xxx(my fetched value) current_value='button button-red' %}
............
............
{%endwith%}
So I am passing if/else
condition inside this WITH/ENDWITH
But it is not accepting current_value
as there is space between two words.Now my question is How to ignore this space and consider value of current_value
as single word?
Upvotes: 0
Views: 601
Reputation: 408
Works for me 😃
{% include '../components/template.html' with new_object=object %}
Upvotes: 0
Reputation: 4138
From discussion on the question above, it looks like it's not in the way you're using the Django {% with %}
tag, but the way that you're then using the reassigned variable in your HTML tag. Change it from
<a href={% some_url %} class={{ current_value }}>
to
<a href={% some_url %} class="{{ current_value }}">
Upvotes: 1