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()
    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/.

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

Uploaded Source

Built Distribution

django_ttag-3.0-py2.py3-none-any.whl (21.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-ttag-3.0.tar.gz.

File metadata

  • Download URL: django-ttag-3.0.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-ttag-3.0.tar.gz
Algorithm Hash digest
SHA256 3a3ae5ad7fd46c8d44007f7fb8e1ca4662dc26b158d80dbef25dbbb2df9f7b9a
MD5 58ecb102e1fe2d4f844181c01048c05c
BLAKE2b-256 b6bf5636ee8d3d13f4a35477c79dc5718e92adde1d8cf64d953b5e65dba5ffc4

See more details on using hashes here.

File details

Details for the file django_ttag-3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_ttag-3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 37d5b8e1390ee387c573df5aeb8759e2f34b3cd5caf3f19c1bb6c8d25d567ec2
MD5 0b7eda09ce85d07534e58f2b36d5a94c
BLAKE2b-256 ff6aff2a17a5ca76a9cbc69470745941acdf7291bf16bd817e08fa76bc89b6c0

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