Monday, January 12, 2009

django-uni-form lives!

Django Uni-Form is my answer to a problem with the Django forms API in that they do not play so well in the arena of the disability access. The default view uses tables which is not disabled friendly. Other views build forms as paragraphs or lists, neither which is optimal for attractive display of HTML forms.

My answer was to create the application above. It incorporates the wonderful uni-form css and javascript combination to create disability-friendly yet attractive forms. Turn off JavaScript, CSS styles, or access it from a mobile phone and these forms should still work. Which is critical in my job. Best of all, you don't have to touch much HTML at all.

I tried to make it as Django generic as I could, but as a Django newbie it is probably a bit rough around the edges. The code, if you examine it, is really clean. I like that about Django efforts - there is no boilerplate!

Anyway, after a bit of setup, you do an easy modification of the form templates that are presenting your Django forms. You should also style it a bit to match your preferences.

Some final notes and comparisons:
  1. Time to get a basic version running was about 45 minutes.
  2. Time to get the styling working was about 1 hour (mostly a stupid mistake on my part).
  3. I'm hoping the Pinax project will incorporate my efforts! ;)
  4. The Django docs were very clear on everything I needed to do. I did not have to leave http://docs.djangoproject.com to accomplish my chosen task. I cannot stress enough that this is something I really enjoy about Django.
  5. This was fun and easy.

Edit on 7/15/2010: Changed the link to django-uni-form on github.

2 comments:

John said...

Thanks a lot, this kicks ass!

pyDanny said...

John, please use the github version, not the google code version!