Skip to main content

Django-pony-forms helps you to write better html for your Django forms

Project description

https://secure.travis-ci.org/mbraak/django_pony_forms.png https://coveralls.io/repos/mbraak/django_pony_forms/badge.png?branch=master https://pypip.in/d/django_pony_forms/badge.png https://pypip.in/v/django_pony_forms/badge.png

Django pony forms

Django-pony-forms helps you to write better html for your Django forms.

Read the documentation on http://django_pony_forms.readthedocs.org/en/latest/index.html

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 1.3.7, 1.4.5 and 1.5.1.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_pony_forms-0.3.3.3.tar.gz (5.2 kB view details)

Uploaded Source

File details

Details for the file django_pony_forms-0.3.3.3.tar.gz.

File metadata

File hashes

Hashes for django_pony_forms-0.3.3.3.tar.gz
Algorithm Hash digest
SHA256 2ad2846c2d33331bb73eedfeb4c0171150525404c107a56b66159dfefb0cd24a
MD5 97cc91a0d5bfacc3a6258740eaaf3a8c
BLAKE2b-256 aa51ba12466038d847b3680add8a3fc3a35d02039f25cda9e2902ebcec57388b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page