skip to navigation
skip to content

Not Logged In

django-ttag 2.4

A template tag constructor library for Django.

Package Documentation

TTag is a template tag constructor library for Django created for the purpose of making writing template tags easier.

The tag syntax is modelled on Django's friendly syntaxes for models and forms. Here is a full example tag:

class Welcome(ttag.Tag)
    user = ttag.Arg()
    fallback = ttag.Arg(named=True, default='Hi!')

    def output(self, data)
        name = data['user'].get_full_name()
        if name:
            return 'Hi, %s!' % name
        return data['fallback']

This would produce a tag named welcome which can be used like this:

{% welcome current_user fallback "Hello, anonymous." %}

More comprehensive usage and reference documentation can be found in the docs directory, or at http://packages.python.org/django-ttag/.

 
File Type Py Version Uploaded on Size
django-ttag-2.4.tar.gz (md5) Source 2011-11-16 26KB
  • Downloads (All Versions):
  • 15 downloads in the last day
  • 209 downloads in the last week
  • 1032 downloads in the last month