title: Remove line breaks from Django template
body: <p>I have a loop in a template like this</p>
  
  <pre><code>{% spaceless %}
  {% for lang_code, lang_name in LANGUAGES %}
      &lt;link hreflang={{ lang_code }} href="http://example.com/
      {% if lang_code|length &gt; 2 %}
          {{ some_path }}
      {% else %}
          {{ other_path }}
      {% endif %}
      "&gt;
  {% endfor %}
  {% endspaceless %}
  </code></pre>
  
  <p>Which produces something like this</p>
  
  <pre><code>&lt;link hreflang="en-gb" href="http://example.com/
      some_path/ 
      "&gt;&lt;link hreflang="de" ...&gt;
  </code></pre>
  
  <p>Is it possible to re-write this code so that the whole tag is written in one line like so?</p>
  
  <pre><code>&lt;link hreflang="en-gb" href="http://example.com/some_path/"&gt;
  &lt;link hreflang="de" href="http://example.com/other_path/"&gt;
  ...
  </code></pre>
  
  <p>P.S. This can be achieved if the if/else clause is stretched over one line, but then the line becomes unreadable.  </p>