python-django-widget-tweaks
Port variant v14
Summary Django template form field customizer (3.14)
Package version 1.6.0
Homepage https://github.com/django-commons/django-widget-tweaks
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v15
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 23 NOV 2026, 05:55:02 UTC
Port created 02 FEB 2018, 15:29:04 UTC
Subpackage Descriptions
single ==================== django-widget-tweaks ==================== :alt: PyPI Version :alt: GitHub Actions Tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes is supported. That should be enough for designers to customize field presentation (using CSS and unobtrusive javascript) without touching python code. License is MIT. Installation ============ You can get Django Widget Tweaks by using pip:: $ pip install django-widget-tweaks To enable `widget_tweaks` in your project you need to add it to `INSTALLED_APPS` in your projects `settings.py` file: .. code-block:: python INSTALLED_APPS += [ 'widget_tweaks', ] Usage ===== This app provides two sets of tools that may be used together or standalone: 1. a render_field template tag for customizing form fields by using an HTML-like syntax. 2. several template filters for customizing form field HTML attributes and CSS classes The render_field tag should be easier to use and should make form field customizations much easier for designers and front-end developers. The template filters are more powerful than the render_field tag, but they use a more complex and less HTML-like syntax. render_field ------------ This is a template tag that can be used as an alternative to aforementioned filters. This template tag renders a field using a syntax similar to plain HTML attributes. Example: .. code-block:: html+django {% load widget_tweaks %} {% render_field form.search_query type="search" %} {% render_field form.text rows="20" cols="20" title="Hello, world!" %} {% render_field form.title class+="css_class_1 css_class_2" %} {% render_field form.text placeholder=form.text.label %} {% render_field form.search_query v-bind::class="{active:isActive}" %} For fields rendered with ``{% render_field %} tag it is possible to set error class and required fields class by using WIDGET_ERROR_CLASS and WIDGET_REQUIRED_CLASS`` template variables: .. code-block:: html+django {% with WIDGET_ERROR_CLASS='my_error' WIDGET_REQUIRED_CLASS='my_required' %} {% render_field form.field1 %} {% render_field form.field2 %} {% render_field form.field3 %} {% endwith %} You can be creative with these variables: e.g. a context processor could set a default CSS error class on all fields rendered by ``{% render_field %}``. attr ---- Adds or replaces any single html attribute for the form field.
Configuration Switches (platform-specific settings discarded)
PY314 ON Build using Python 3.14 PY315 OFF Build using Python 3.15
Package Dependencies by Type
Build (only) python314:dev:std
python-pip:single:v14
autoselect-python:single:std
Build and Runtime python314:primary:std
Runtime (only) python-Django:single:v14
Download groups
main mirror://PYPIWHL/7d/3b/99133c3f6b3d18559dd450c5053616737502199a8c0bffeaae6ce8d93c6d
Distribution File Information
4c53824ae0b44f89c0a0011eada8d656647384c0dd34ba96663e47b4bd6dadbd 9658 python-src/django_widget_tweaks-1.6.0-py3-none-any.whl
Ports that require python-django-widget-tweaks:v14
No other ports depend on this one.