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-2.tar.gz (204.9 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for django-ttag-1.0-alpha-2.tar.gz
Algorithm Hash digest
SHA256 f8d7e67e924e9ff950519ce971cff8f276be02f614ab1367379893eca40bc81b
MD5 0ca3795271653a045ef625dc6c7c5152
BLAKE2b-256 717c1ebf58addef88ba41c1b8fdaa925b16364c50b37179b7aae97a8a57cf15a

See more details on using hashes here.

Provenance

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