Login

Tag "counter"

Snippet List

Django Incremental Counter Tag

Counter tag. Can be used to output and increment a counter. For usage, see docstring in the code. This is the first complete tag that I've implemented, I hope that there are no bugs and that it's thread safe.

  • incremental
  • counter
  • increment
  • numbering
Read More

counter templatetag

The counter initializes the variable to 0, and next it increments one by one: {% load counter_tag %} {% for pet in pets %} {% if pet.is_cat %} {% counter cats %} {% else %} {% counter dogs %} {% endif %} {% endfor %} # cats: {{cats}} # dogs: {{dogs}}

  • template
  • django
  • counter
  • increment
  • loop
Read More

2 snippets posted so far.