# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-django-widget-tweaks VERSION= 1.5.0 KEYWORDS= python VARIANTS= v11 v12 SDESC[v11]= Django template form field customizer (3.11) SDESC[v12]= Django template form field customizer (3.12) HOMEPAGE= https://github.com/jazzband/django-widget-tweaks CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/46/6a/6cb6deb5c38b785c77c3ba66f53051eada49205979c407323eb666930915 DISTFILE[1]= django_widget_tweaks-1.5.0-py3-none-any.whl:main DF_INDEX= 1 SPKGS[v11]= single SPKGS[v12]= single OPTIONS_AVAILABLE= PY311 PY312 OPTIONS_STANDARD= none VOPTS[v11]= PY311=ON PY312=OFF VOPTS[v12]= PY311=OFF PY312=ON DISTNAME= django_widget_tweaks-1.5.0.dist-info GENERATED= yes [PY311].USES_ON= python:v11,wheel [PY312].USES_ON= python:v12,wheel [FILE:2702:descriptions/desc.single] ==================== django-widget-tweaks ==================== :alt: Jazzband :alt: PyPI Version :alt: GitHub Actions :alt: Coverage 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 %}``. [FILE:122:distinfo] a41b7b2f05bd44d673d11ebd6c09a96f1d013ee98121cb98c384fe84e33b881e 8960 django_widget_tweaks-1.5.0-py3-none-any.whl