2👍
✅
you can easily get rid of all the unnecessary spaces django produces by using: {% spaceless %}
tag see doc: https://docs.djangoproject.com/en/dev/ref/templates/builtins/#spaceless
{% spaceless %}
<div id="selected-sources" style="min-height:150px; max-height:500px">
{% for source in sources %}
<span id='{{source.0}}' class='tag_with_remove'>
<i class='icon-remove'></i>
<span class='label'>source: {{source.1}}</span>
</span>
{% endfor %}
</div>
{% endspaceless %}
0👍
If I am understanding this correctly, you could do something like it says in the template docs:
{% if sources %}
<div id="selected-sources" style="min-height:150px; max-height:500px">
{% for source in sources %}
<span id='{{source.0}}' class='tag_with_remove'>
<i class='icon-remove'></i>
<span class='label'>source: {{source.1}}</span>
</span>
{% endfor %}
</div>
{% else %}
<div id="selected-sources" style="min-height:150px; max-height:500px"></div>
{% endif %}
Source:stackexchange.com