from django import template


register = template.Library()


@register.filter
def index(List, i):
    try:
        return List[int(i)]
    except IndexError:
        return ''
    except TypeError:
        return ''


@register.filter
def lookup(dictionary, key):
    return dictionary.get(key)


# With thanks to https://stackoverflow.com/a/12797728
@register.filter
def times(number):
    return range(number)

@@ -406,8 +406,124 @@
 number)%0A
+%0A%0A# With thanks to https://stackoverflow.com/a/15820445%0A@register.filter%0Adef to_int(number):%0A    return int(number)%0A

Add to_int template tag