Skip to main content

A template tag constructor library for Django.

Project description

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(positional=True)
    fallback = ttag.Arg(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/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-ttag-1.0-alpha-4.tar.gz (214.0 kB view details)

Uploaded Source

File details

Details for the file django-ttag-1.0-alpha-4.tar.gz.

File metadata

File hashes

Hashes for django-ttag-1.0-alpha-4.tar.gz
Algorithm Hash digest
SHA256 97854f7a195973c55d1c93d4fa14c1d9fda5ebc368f64536184c1fc68c8087f2
MD5 6e75ed148e6b80625bf91df3fca92936
BLAKE2b-256 33aac93b7a31ddfae771f0c4a03459f0295748f1c540eb17af1775f7d5e7df3a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page