--- id: django-widget-tweaks version: "1.5.1" license: MIT license license_treatment: permissive maintenance: active --- # django-widget-tweaks — Tweak the form field rendering in templates, not in python-level form definitions. License: permissive · Maintenance: active · Downloads: 1.6M/mo ## What it is and what it does django-widget-tweaks is a template library that lets designers and front-end developers customize how Django form fields render in HTML without writing Python code. It provides template tags and filters to add or modify CSS classes, HTML attributes, and data attributes on form fields directly in templates. The package offers two main interfaces: a `render_field` tag with HTML-like syntax for straightforward customization, and a set of filters (`add_class`, `attr`, `set_data`, `add_error_class`, etc.) for more granular control. It handles single and multi-widget fields, supports filter chaining with leftmost-wins semantics for reusable templates, and integrates cleanly with Django's form rendering pipeline. Use it for: - Add CSS classes to form fields for styling without touching Python form code. - Set HTML5 data attributes on fields for unobtrusive JavaScript hooks. - Apply error or required-field styling conditionally based on validation state. - Convert input types to HTML5 variants (e.g., text to search) in templates. - Build reusable field templates with overridable default attributes. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Customize Django form field HTML and CSS in templates using template tags and filters, without modifying Python form definitions. Yes. It is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and solves a real workflow problem—separating form presentation from Python logic. Install if your Django project has designers or front-end developers who need to customize form rendering without Python changes. ## Install pip install django-widget-tweaks uv add django-widget-tweaks poetry add django-widget-tweaks ## Installing django-widget-tweaks Before you install: Low friction: pure Python wheel with only django as a runtime dependency. Active maintenance—last commit 2026-06-29, 2163 repository stars, and a release within the last year. License in practice: MIT license (permissive). No restrictions on commercial or private use; you may modify and redistribute with attribution. Quickstart: # Install pip install django-widget-tweaks # Add to INSTALLED_APPS in settings.py INSTALLED_APPS += ['widget_tweaks'] # In template {% load widget_tweaks %} {{ form.title|add_class:"css_class_1 css_class_2" }} {% render_field form.search_query type="search" %} ## Package facts - License: MIT license (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags django form field styling, template form customization, django css class form fields, html attribute form tweaks, django template form rendering, django-forms, template-filters [View on SkillFed](https://skillfed.io/packages/django-widget-tweaks) · [View on PyPI](https://pypi.org/project/django-widget-tweaks/)