public
Description: Fieldset Rendering For Non-Admin Forms
Homepage:
Clone URL: git://github.com/muhuk/django-formfieldset.git
name age message
file LICENSE.txt Thu Mar 12 13:15:46 -0700 2009 Fix license [muhuk]
file README.markdown Loading commit data...
directory example/ Sat Nov 28 01:55:05 -0800 2009 Rename old example [muhuk]
directory formfieldset/
file setup.py
README.markdown

django-formfieldset is a simple Django app that provides a mix-in class for admin-like fieldset rendering.

Features

  • Fieldset functionality similar to ModelAdmin
  • Shorthand rendering functions with fieldsets
    • as P
    • as TABLE
    • as UL
  • Overrides nothing in django.forms.Form

Installation

  1. Add "django-formfieldset" directory to your Python path.
  2. Add "formfieldset" to your INSTALLED_APPS tuple found in your settings file. (optional - to be able to run tests)
  3. Create your forms with FieldsetMixin

Testing & Example

There is an example project in the example/ folder. To run automated tests for django-formfieldset run the following command in example/ directory:

python manage.py test formfieldset

To run the example project:

python manage.py runserver

Then you can visit http://localhost:8000/ to view the example.

Usage

  1. Add a fieldsets attribute to your form. See admin docs for detailed explanation.
  2. Render your form with fieldset enabled methods:
    • You can use iter_fieldsets() for custom form rendering. It will yield Fieldset objects. Fieldsets act as iterators for widgets in them.
    • You can use as_fieldset_table(), as_fieldset_ul() and as_fieldset_p() methods that act like built-in as_* method except fieldset support.