This software provides form utilities for Django, making it easier to create and manage forms in Django-based web applications.
Django-form-utils is a powerful Django application that offers BetterForm and BetterModelForm classes. These classes are fantastic subclasses of django.forms.Form and django.forms.ModelForm, respectively. BetterForm and BetterModelForm provide users with the flexibility to subdivide their forms into iterable fieldsets from the template. Additionally, they allow for the definition of row_attrs accessible from the template to apply attributes to the surrounding container (, , or whatever) of a particular form field.
One can easily install django-form-utils on their Python path once they obtain the installation files from INSTALL.txt. After installation, add form_utils to your INSTALLED_APPS setting. However, django-form-utils does not provide any models. Thus, installing it in INSTALLED_APPS makes the form_utils template tag library available.
Moreover, users can override the default form rendering templates by providing alternate templates at templates/form_utils/better_form.html and templates/form_utils/form.html. To use django-form-utils, users must inherit their form class from form_utils.forms.BetterForm (instead of django.forms.Form) or their modelform class from form_utils.forms.BetterModelForm. Afterward, they can define the fieldsets and/or row_attrs attributes of the inner Meta class.
Fieldset definitions are similar to ModelAdmin fieldset definitions- each fieldset is a two-tuple with a name and an options dictionary. Valid fieldset options in the dictionary include fields, classes, legend, and description. Fieldsets attribute of a BetterForm (or BetterModelForm) yields Fieldset s that display the aforementioned attributes when iterated over.
For backwards compatibility, a BetterForm or BetterModelForm can still be iterated over to show all of its BoundField s, regardless of their fieldsets. More detailed examples and doctests can be found in tests/__init__.py.
The application also provides a convenience template filter, render. It checks whether the form is a BetterForm and renders it using the template form_utils/better_form.html. If not, it renders it using the template form_utils/form.html. Users can pass the form object to the render template's context as form, along with an optional argument, which is a comma-separated list of template names to use for rendering the form.
In conclusion, django-form-utils is an incredibly useful application for Django developers, offering flexibility and convenience when working with forms. Its extensive features and ease of use make it a must-have for Django developers.
One can easily install django-form-utils on their Python path once they obtain the installation files from INSTALL.txt. After installation, add form_utils to your INSTALLED_APPS setting. However, django-form-utils does not provide any models. Thus, installing it in INSTALLED_APPS makes the form_utils template tag library available.
Moreover, users can override the default form rendering templates by providing alternate templates at templates/form_utils/better_form.html and templates/form_utils/form.html. To use django-form-utils, users must inherit their form class from form_utils.forms.BetterForm (instead of django.forms.Form) or their modelform class from form_utils.forms.BetterModelForm. Afterward, they can define the fieldsets and/or row_attrs attributes of the inner Meta class.
Fieldset definitions are similar to ModelAdmin fieldset definitions- each fieldset is a two-tuple with a name and an options dictionary. Valid fieldset options in the dictionary include fields, classes, legend, and description. Fieldsets attribute of a BetterForm (or BetterModelForm) yields Fieldset s that display the aforementioned attributes when iterated over.
For backwards compatibility, a BetterForm or BetterModelForm can still be iterated over to show all of its BoundField s, regardless of their fieldsets. More detailed examples and doctests can be found in tests/__init__.py.
The application also provides a convenience template filter, render. It checks whether the form is a BetterForm and renders it using the template form_utils/better_form.html. If not, it renders it using the template form_utils/form.html. Users can pass the form object to the render template's context as form, along with an optional argument, which is a comma-separated list of template names to use for rendering the form.
In conclusion, django-form-utils is an incredibly useful application for Django developers, offering flexibility and convenience when working with forms. Its extensive features and ease of use make it a must-have for Django developers.
What's New
Version 0.1.5: N/A