Skip to main content

Fieldset Rendering For Non-Admin Forms

Project description

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 both for whole forms and for individual fieldsets

    • render as P

    • render as TABLE

    • render as UL

  • Template strings are class attributes

  • 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)

Testing & Example

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

python example/manage.py test formfieldset

To run the example project:

python example/manage.py runserver

Then you can visit http://localhost:8000/ to view the example. Example project also serves as detailed documentation for formfieldset.

Code examples will be highlighted if you have pygments installed.

Usage

  1. Create your form with FieldsetMixin.

  2. Add a fieldsets attribute to your form. See admin docs for detailed explanation.

  3. 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.

Tutorials & How-to’s

See Also

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-formfieldset-1.1.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file django-formfieldset-1.1.tar.gz.

File metadata

File hashes

Hashes for django-formfieldset-1.1.tar.gz
Algorithm Hash digest
SHA256 052dbb3742de228bb05b92838c43b5b9d0be3348f2a9bb151eb34c9cae3d7d38
MD5 969bd0cf86828c1759d10c6c305c8788
BLAKE2b-256 f003d98904015205356b69bdae00f3b44f0fd36fc1dae2ddcaab4fd14ef5565f

See more details on using hashes here.

Supported by

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