Source

noodle-bucket / util / templatetags / nbfilters.py

Full commit
from django import template

register = template.Library()

@register.filter
def truncate_chars(value, arg):
    if len(value) < arg:
        return value
    else:
        return value[:arg] + '...'

@register.filter
def firstline(value):
    return value.splitlines()[0]