CARVIEW |
Every repository with this icon (

Every repository with this icon (

Description: | Django forms are easily rendered as tables, paragraphs, and unordered lists. However, elegantly rendered div based forms is something you have to do by hand. The purpose of this application is to provide a simple tag and/or filter that lets you quickly render forms in a div format. |
Clone URL: |
git://github.com/pydanny/django-uni-form.git
Give this clone URL to anyone.
git clone git://github.com/pydanny/django-uni-form.git
|

name | age | message | |
---|---|---|---|
![]() |
CONTRIBUTORS.txt | Sat Jan 24 13:28:17 -0800 2009 | Eggifying django-uni-form git-svn-id: https://d... [Daniel Greenfeld] |
![]() |
LICENSE.txt | Sat Jan 24 13:28:17 -0800 2009 | Eggifying django-uni-form git-svn-id: https://d... [Daniel Greenfeld] |
![]() |
MANIFEST.in | Wed Apr 01 16:28:55 -0700 2009 | eggification [Daniel Greenfeld] |
![]() |
README | Thu Apr 09 10:39:57 -0700 2009 | rst test [Daniel Greenfeld] |
![]() |
README.rst | Thu Apr 09 08:42:38 -0700 2009 | Fixing links [Daniel Greenfeld] |
![]() |
docs/ | Fri Apr 03 13:55:34 -0700 2009 | Lots of docs stuff [Daniel Greenfeld] |
![]() |
setup.py | Fri Apr 03 14:32:01 -0700 2009 | Changes to reflect new version [Daniel Greenfeld] |
![]() |
uni_form/ | Tue Apr 21 10:00:47 -0700 2009 | Fixing form helper [Daniel Greenfeld] |
django-uni-form (Django Uni-Form)
Django forms are easily rendered as tables, paragraphs, and unordered lists. However, elegantly rendered div based forms is something you have to do by hand. The purpose of this application is to provide a simple tag and/or filter that lets you quickly render forms in a div format.
Uni-form has been selected as the base model for the design of the forms.
Installing django-uni-form
Install as uni_form in your Django apps directory.
-
- Copy the site_media files in uni_form to your project site_media directory.
uni-form-generic.css uni-form.css uni-form.jquery.js
Add 'uni_form' to INSTALLED_APPS in settings.py.
Using the django-uni-form filter (Easy and fun!)
Add {% load uni_form %} to the template that calls your form.
Append your form call with the as_uni_form filter:
{{ my_form|as_uni_form }}
Add the class of 'uniForm' to your form. Example:
<form action="" method="post" class="uniForm">
Refresh and enjoy!
Using the django-uni-form templatetag in your view (Intermediate)
In your form class add the following after field definitions:
from django.shortcuts import render_to_response from uni_form.helpers import FormHelper, Submit, Reset from my_project.forms.MyForm def my_view(request): # Create the form form = MyForm() # create a formHelper helper = FormHelper() # Add in a class and id helper.form_id = 'this-form-rocks' helper.form_class = 'search' # add in a submit and reset button submit = Submit('search','search this site') helper.add_input(submit) reset = Reset('reset','reset button') helper.add_input(reset) # create the response dictionary response_dictionary = {'form':form, 'helper': helper} return render_to_response('my_template.html', response_dictionary)
In your template do the following:
{% load uni_form %} {% uni_form form helper %}
Using the django-uni-form templatetag in your form class (Intermediate)
In your form class add the following after field definitions:
from uni_form.helpers import FormHelper, Submit, Reset class MyForm(forms.Form): title = forms.CharField(label=_("Title"), max_length=30, widget=forms.TextInput()) # Attach a formHelper to your forms class. helper = FormHelper() # Add in a class and id helper.form_id = 'this-form-rocks' helper.form_class = 'search' # add in a submit and reset button submit = Submit('search','search this site') helper.add_input(submit) reset = Reset('reset','reset button') helper.add_input(reset)
In your template do the following:
{% load uni_form %} {% with form.helper as helper %} {% uni_form form helper %} {% endwith %}