Django-pony-forms helps you to write better html for your Django forms
Project description
Django pony forms
Django-pony-forms helps you to write better html for your Django forms.
Read the documentation on readthedocs
1: Better form html by default
The form html that Django produces is not very nice or useful. For example, the default output of a Django form is a table.
Just mixin PonyFormMixin to produce better html:
class ExampleForm(PonyFormMixin, forms.Form):
name = forms.CharField()
This produces the following html:
<div class="form-row row-name">
<label for="id_name">Name</label>
<input type="text" id="id_name" name="name" />
</div>
2: Write your own form templates
You can also write your own form templates:
class ExampleForm(PonyFormMixin, forms.Form):
name = forms.CharField()
form_template = 'my_form.html'
row_template = 'my_row.html'
my_form.html:
<div class="my_form">
{{ hidden_fields }}
{{ top_errors }}
{{ rows }}
</div>
Requirements
The package is tested with Django 2.2 - 3.1 and Python 3.6 - 3.8.
Installation
Install the package:
$ pip install django_pony_forms
Add django_pony_forms to your installed apps in settings.py.
INSTALLED_APPS = (
..
'django_pony_forms',
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for django_pony_forms-1.1.0-py3.8.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0feec1b7eaeabc42b239ee7e71a2b2309afe867a359937a50c32f1da7947c650 |
|
MD5 | b68c85600c5a9fabecd47347ba2fc9a9 |
|
BLAKE2b-256 | b34021d17491fc267d44f37eec2f0a983e83ed26c51e024bb6e88edd58114cdc |
Hashes for django_pony_forms-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a13c5c18968861f9206b937b6d6b25271746f4dbf64bec3cece6e74c5271232 |
|
MD5 | 2f128135edce626ea1c5e1d8e7ca7d14 |
|
BLAKE2b-256 | 964b64b0d2bc9e009d637a008f93a694edafc8f69ef6e992566de6402c2b03c6 |