title: If statement in my Django template...Is there a better way?
body: <p>In my Django template: I'm trying to add an extra div around my for loop only if the length of the data being passed to the template is 3. This is what I'm trying right now but it seems like there could be better way than doing two if statements to check for the length:</p>
  
  <pre><code>  {% if items|length == 3 %}
      &lt;div class='three-item-wrap'&gt;
    {% endif %}
  
        {% for item in items %}
          .......
        {% endfor %}
  
    {% if items|length == 3 %}
      &lt;/div&gt; //close .three-item-wrap
    {% endif %}
  </code></pre>