django-classy-tags
Class based template tags for Django
What it is and what it does
Django Classy Tags is a library that provides a class-based alternative to Django's function-based template tag pattern. Instead of writing procedural parsing logic, you declare your tag's arguments and behavior as class attributes, then implement methods to compute the output. The library handles argument parsing, validation, and integration with Django's template system automatically.
It is typically used when building reusable template tags for Django projects—particularly when tags have complex or optional arguments. The package supports parse-until blocks (for tags that wrap template content) and is designed to be extensible for custom argument types and tag behaviors.
Use it for:
- Build custom template tags with optional arguments and defaults without writing custom parsing logic.
- Create tags that store computed values in template variables using the 'as' pattern.
- Implement block-level template tags that wrap and process template content between opening and closing tags.
- Reduce boilerplate when maintaining a library of reusable Django template tags across projects.
- Extend tag behavior through inheritance when multiple tags share similar argument structures.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a class-based system for writing Django template tags with declarative argument parsing, reducing boilerplate while maintaining full compatibility with Django's templating infrastructure.
Yes. This is a stable, actively maintained library (last commit 2026-08-10) with no known vulnerabilities, low install friction, and a permissive BSD license. It directly addresses template tag verbosity in Django development and is well-suited for any Django project that uses custom template tags.
Install
django-classy-tags on PyPI
pip
pip install django-classy-tagsuv
uv add django-classy-tagspoetry
poetry add django-classy-tagsInstalling django-classy-tags
Before you install
Low friction installation with a single wheel distribution. Actively maintained as of August 2026 with recent commits; supports current Python versions (3.8–3.11) and modern Django releases (3.2–4.2).
License in practice
BSD permissive license allows use in commercial and private projects with minimal restrictions; no copyleft obligations.
Quickstart
pip install django-classy-tags
from django import template
register = template.Library()
# Define a class-based tag with declarative options and arguments
# Implement get_value() to compute the tag's output
Requires django to be installed; intended for use within Django projects only.
Verify before relying
- Whether the class-based approach is actually cleaner or more maintainable than Django's default function-based pattern in practice.
- Real-world performance characteristics compared to standard Django template tags.
- Adoption rate and community feedback on the class-based pattern versus alternatives.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — django |
| Maintenance | actively maintained — 1,112 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 412,307/month — #6,849 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_classy_tags-4.1.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
django-sekizaiDjango Sekizai provides template block…
permissive · top 15,000 on PyPI
djangocms-text-ckeditorIntegrates CKEditor (v4.17.2) as a text editing…
permissive · top 15,000 on PyPI
django-cmsdjango CMS is a Django-based content management…
permissive · top 15,000 on PyPI
django-componentsdjango-components lets you build reusable,…
permissive · top 15,000 on PyPI
django-jinjaIntegrates Jinja2 templating into Django,…
permissive · top 15,000 on PyPI
djangocms-admin-styleProvides styled CSS templates and admin…
permissive · top 15,000 on PyPI
crispy-bootstrap3Provides Bootstrap 3 HTML templates for…
permissive · top 15,000 on PyPI
djangocms-attributes-fieldProvides a Django model field and widget for…
permissive · top 15,000 on PyPI
html5taggerGenerates HTML5 markup programmatically using…
permissive · top 5,000 on PyPI
django-decorator-includeApplies decorators to Django URL patterns…
permissive · top 15,000 on PyPI