Source

dvd-collection / collection / templatetags / bootstrap.py

Full commit
from django import template
from django.utils.safestring import mark_safe

register = template.Library()

@register.filter
def yesnoicon(value):
    icon = "ok" if value else "remove"
    return mark_safe('<i class="icon-%s"></i>' % icon)

@register.filter
def ratingicon(value):
    return mark_safe('<i class="icon-star"></i>' * value)

@register.filter
def link(value):
    try:
        return mark_safe('<a href="%s">%s</a>' % (value.get_absolute_url(), value))
    except:
        return 'None'

@register.filter
def make_range(value):
    return range(1, int(value+1))