Template filter to get a list element by its index

1
2
3
4
5
6
7
from django import template

register = template.Library()

@register.filter
def get_at_index(list, index):
    return list[index]

More like this

  1. Template tag to create a list from one or more variables and/or literals by davidchambers 2 years, 9 months ago
  2. Yet another SQL debugging facility by miracle2k 5 years, 10 months ago
  3. Template filter that divides a list into exact columns by davmuz 1 year, 5 months ago
  4. Tags & filters for rendering search results by exogen 5 years, 2 months ago
  5. Templatetag startswith + message tuned by io_error 5 years ago

Comments

(Forgotten your password?)