Skip to main content

pypi build coverage

The goal of this project is to create a new way of writing Django template tags which is fully compatible with the current Django templating infrastructure. This new way should be easy, clean and require as little boilerplate code as possible while still staying as powerful as possible. Some features:

  • Class based template tags.

  • Template tag argument parser.

  • Declarative way to define arguments.

  • Supports (theoretically infinite) parse-until blocks.

  • Extensible!

Contribute to this project and win rewards

Because this is a an open-source project, we welcome everyone to get involved in the project and receive a reward for their contribution. Become part of a fantastic community and help us make django CMS the best CMS in the world.

We’ll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.

We’re grateful to all contributors who have helped create and maintain this package. Contributors are listed at the contributors section.

Documentation

See REQUIREMENTS in the setup.py file for additional dependencies:

python django

Please refer to the documentation in the docs/ directory for more information or visit our online documentation.

Example

This is how a tag looks like using django-classy-tags:

from classytags.core import Options
from classytags.helpers import AsTag
from classytags.arguments import Argument
from django import template

register = template.Library()

class Hello(AsTag):
    options = Options(
        Argument('name', required=False, default='world'),
        'as',
        Argument('varname', required=False, resolve=False)
    )

    def get_value(self, context, name):
        return 'hello %s' % name

register.tag(Hello)

That’s your standard hello world example. Which can be used like this:

  • {% hello %}: Outputs hello world

  • {% hello "classytags" %}: Outputs hello classytags

  • {% hello as myvar %}: Outputs nothing but stores hello world into the template variable myvar.

  • {% hello "my friend" as othervar %}: Outputs nothing but stores hello my friend into the template variable othervar.

Running Tests

You can run tests by executing:

virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test

Release files for django-classy-tags 4.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-classy-tags 4.1.0
File Size Uploaded
django-classy-tags-4.1.0.tar.gz 24.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-classy-tags 4.1.0
File Interpreter ABI Platform
django_classy_tags-4.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.8 kB

Release files / django-classy-tags-4.1.0.tar.gz

Download URL django-classy-tags-4.1.0.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c8d9d1aa2fa6e71c4d866df4dd11d23a69b8d25bbb750b2490a17b161774ee59
BLAKE2b-256 checksum
How to use checksums
917f18da9d8fcc469fc7aa74abc526aacaa3cc7180ad2208f80d43e8b670aed6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / django_classy_tags-4.1.0-py3-none-any.whl

Download URL django_classy_tags-4.1.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c784cf1bac49c20a77b8f7d1541867c64076642a160a847ff449588d4e01e55
BLAKE2b-256 checksum
How to use checksums
6d1013afc12b7d9657ed67f8d49c1cf0585a4331b197ed98ea654e9ed8034e79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

4.1.0 This release

2 release files

4.0.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.0.0

1 release file

0.9.0

1 release file

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

0.5.2

3 release files

0.5.1

1 release file

0.5

1 release file

0.4

1 release file

0.3.5

1 release file

0.3.4.1

1 release file

0.3.4

1 release file

0.3.3.1

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page