Sometimes form.as_p doesn't cut it. This app adds more render methods to all forms.
Project description
Django Form Renderers
Sometimes form.as_p doesn’t cut it. This app adds more render methods to all forms.
Installation
Install or add django-form-renderers to your Python path.
Add form_renderers to your INSTALLED_APPS setting.
What it does
Every form receives a div-based render method called as_div.
If a field is required then an attribute required="required" is rendered for every widget.
Defining your own renderers
Create either form_renderers.py or form_renderers/__init__.py in your app. Each renderer must be a function:
def as_some_renderer(form): return form._html_output( ... ) def as_another_renderer(form): return form._html_output( ... )
You can override the default as_div by creating a renderer called as_div in your app. The same rules that apply for Django template overriding apply to renderer overriding.
Changelog
0.1.1
Allow apps to specify custom renderers.
0.1
First release.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-form-renderers-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2e64722e04fda88e511cc82dacdf3134cf5329373f1307ef6aac4cc5f732c15 |
|
MD5 | 0b27014010635e2165a1178387685695 |
|
BLAKE2b-256 | e834ab44406e66636ab75051e2923de46c942184151f5c95f0a6ba6735b9adbf |
Hashes for django_form_renderers-0.1.1-py2.7.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46790c541b235a803506a388648f03f66b8140a1a943effef71601ec8edd7190 |
|
MD5 | cb5a62571a4687d715029ffbf37f4387 |
|
BLAKE2b-256 | dcc5be426021959cdb5878cbfd316d9482428bc76aafbef68ee176bcd32e8e7a |