[Fixed]-Using Django template divisibilityby tag with .eco template?

1👍

I’ve never used – or even heard of – eco templates before, but looking at the documentation, it’s clear that they are very different from Django templates in inspiration, and more to the point that they can support arbitrary CoffeeScript operations. So, rather than looking for “a way to do this in eco”, you should be looking for a way to do this in CoffeeScript.

Again, I’ve never used CoffeeScript, but looks like this would work:

   <% for thing, i in @things.models: %>
           <% if i % 2 == 0 %>
                    <div class="row">
            <% end %>
                          <div class="col-md-6">test</div>
                          <div class="col-md-6">test</div>
           <% if (i + 1) % 2 == 0 %>
                    </div>
           <% end %>
  <% end %>

Leave a comment