Saturday 14 April 2012

Nicer Forms for web.py

Get it here

So web.py has a form module. That form module produces forms that:

  1. Are in tables
  2. Have no form tags
To combat a I subclassed the Form object and wrote it a new render function.
As b had sensible reasons for not adding form tags (one might wish to use multiple form objects in a single form) I didn't add form tags to the render output, instead I created a new class that stores a list of forms and a dictionary of attributes, its render method then renders all of the forms in order and surrounds them with a form tag with the supplied attributes.

The code is available on Bitbucket as usual and could do with perhaps putting the forms in id'd divs so people can move them around with CSS.

No comments:

Post a Comment