This project exists to make defining template tags in Django kickass
Latest commit de173c8 Mar 24, 2014 @alex bump version
Failed to load latest commit information.
.gitignore Initial commit Nov 6, 2009
LICENSE Renamed the project to django-templatetag-sugar Nov 8, 2009
README.rst Syntax highlight. Mar 24, 2014
setup.cfg Mark as a univesral wheel Mar 24, 2014 improvements Mar 24, 2014



A library to make writing templatetags in Django sweet.

Here's an example of using:

from django import template

from templatetag_sugar.register import tag
from templatetag_sugar.parser import Name, Variable, Constant, Optional, Model

register = template.Library()

@tag(register, [Constant("for"), Variable(), Optional([Constant("as"), Name()])]):
def example_tag(context, val, asvar=None):
    if asvar:
        context[asvar] = val
        return ""
        return val

As you can see it makes it super simple to define the syntax for a tag.