skillfed

django-classy-tags

Class based template tags for Django

django-classy-tags v4.1.0 412.3K downloads/30d#6,849 on PyPI380
Permissive license BSD Active released

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-tags

uv

uv add django-classy-tags

poetry

poetry add django-classy-tags

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 3.2Framework :: Django :: 4.0Framework :: Django :: 4.1Framework :: Django :: 4.2Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software DevelopmentTopic :: Software Development :: Libraries

Tags

django template tags class baseddjango template tag argument parserdjango custom template tagsdjango template tag boilerplatedjango classy tags
django-template-tags

More Software Development packages

typing-extensions

Provides backported and experimental type hints…

permissive · top 100 on PyPI

numpy

NumPy provides an N-dimensional array object…

permissive · top 100 on PyPI

fastapi

FastAPI is a Python web framework for building…

permissive · top 100 on PyPI

annotated-doc

Provides a way to document function parameters,…

permissive · top 100 on PyPI

typer

Typer builds command-line applications from…

permissive · top 1,000 on PyPI

distlib

Distlib provides low-level packaging utilities…

permissive · top 1,000 on PyPI

django-sekizai

Django Sekizai provides template block…

permissive · top 15,000 on PyPI

djangocms-text-ckeditor

Integrates CKEditor (v4.17.2) as a text editing…

permissive · top 15,000 on PyPI

django-cms

django CMS is a Django-based content management…

permissive · top 15,000 on PyPI

django-components

django-components lets you build reusable,…

permissive · top 15,000 on PyPI

django-jinja

Integrates Jinja2 templating into Django,…

permissive · top 15,000 on PyPI

djangocms-admin-style

Provides styled CSS templates and admin…

permissive · top 15,000 on PyPI

crispy-bootstrap3

Provides Bootstrap 3 HTML templates for…

permissive · top 15,000 on PyPI

djangocms-attributes-field

Provides a Django model field and widget for…

permissive · top 15,000 on PyPI

html5tagger

Generates HTML5 markup programmatically using…

permissive · top 5,000 on PyPI

django-decorator-include

Applies decorators to Django URL patterns…

permissive · top 15,000 on PyPI