Re: [SQLObject] SQLObject auto generated HTML forms?
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Ian B. <ia...@co...> - 2003-09-09 16:11:51
|
On Tuesday, September 9, 2003, at 08:55 AM, Simon Willison wrote: > Hi all, > > Has anyone done any work on extending SQLObject classes to > auto-generate HTML forms for adding / editing data in tables? I'm > about to start work on an extension to do just that but if someone has > already worked on it I'd rather not reinvent the wheel. I've been working on a (still incomplete) for generation package, in webware-sandbox.sf.net CVS, /Sandbox/ianbicking/FormEncode -- the validation that I just recently added to SQLObject is taken from that package. I'm definitely looking for input and ideas about how it should work -- mostly about how to make the interface general and also reasonable (i.e., not too verbose, or requiring mental gyrations to figure out how to work with and customize to your needs). What's already in SQLObject should be expanded so you can add HTTP/HTML specific validators (and some of that process is in place in Validator.py). Then you need to be able to annotate the class as a whole, so you can add attributes, hide columns from forms, etc. I'm hoping that interfaces/adapters (probably taken from Zope 3's implementation) will aid in that. Then the form generation has to be worked out. I'm envisioning a limited number of generation possibilities at this point -- simplistic generation (useful for unit testing) that produces minimal HTML; a standard table-based layout, similar to what you might see in a registration form (labels ontop of input elements); and a template-based layout that inspects the HTML directly, replacing VALUE attributes, setting SELECTED attributes, etc. *But*, I don't want to just pile these features on, because the result won't be general enough, or will be too verbose, or too hard to work with. But these desires have kept me from finishing this off and putting it all together, even though the pieces are largely in place (except the HTML interpretation, but that's a recent plan on my part). Anyway, that's my plan. You're still welcome to have your own too ;) It would be nice if you used FormEncode's validation, though, even if you use something else for the other parts. Ian |