Can I suppress newlines after each template tag with Django's template engine?
- by ento
In Rails ERB, you can suppress newlines by adding a trailing hyphen to tags:
<ul>
<% for @item in @items -%>
<li><%= @item %></li>
<% end -%>
</ul>
becomes:
<ul>
<li>apple</li>
<li>banana</li>
<li>cacao</li>
</ul>
Is there a way to do this in Django? (Disclosure: I'm generating a csv file with Django)
Edit: Clarified that the newlines I'm hunting down are the ones left behind after the template tags.