Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Forking this to add some decent documentation so I don't have to dig through the source code each frigging time
Python
branch: master

This branch is 1 commit ahead, 12 commits behind alex:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
templatetag_sugar
.gitignore
LICENSE
README.markdown
setup.py

README.markdown

django-templatetag-sugar

A library to make writing templatetags in Django sweet.

Install it:

pip install -e git://github.com/alex/django-templatetag-sugar.git#egg=templatetag_sugar

Put this sucker into yourapp/templatetags/some_tags.py and {% load some_tags %} in your templates:

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

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 ""
    else:
        return val
Something went wrong with that request. Please try again.