skip to navigation
skip to content

django-templatetag-sugar 1.0

A library to make Django's template tags sweet.

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.

File Type Py Version Uploaded on Size
django-templatetag-sugar-1.0.tar.gz (md5, pgp) Source 2014-03-24 2KB
django_templatetag_sugar-1.0-py2.py3-none-any.whl (md5, pgp) Python Wheel py2.py3 2014-03-24 5KB