Can I suppress newlines after each template tag with Django's template engine?

后端 未结 5 2319
醉梦人生
醉梦人生 2021-02-19 08:05

In Rails ERB, you can suppress newlines by adding a trailing hyphen to tags:

    <% for @item in @items -%>
  • <%= @item %>
5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-19 09:05

    It is 2016 now, and I think this issue is still present. In this tutorial https://www.youtube.com/watch?v=vQjmz9wCjLA at around 1:45 a unittest of a template shows that there is a trailing newline on the end of the tag.

提交回复
热议问题