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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for django-ttag-2.1.1.tar.gz
Algorithm Hash digest
SHA256 41328d0302374fd0b7c375fa723055936a07e0ba23679b48b88d3daf93047694
MD5 d0358d83d4f5b0d27d88826d50b8d084
BLAKE2b-256 1e23481dc72dee10043a3bebc55016181499648fa2c4c406ae22f871f2affad4

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