The web2py app wizard has a Dynamic model creator, may be you can take a look in to the wizard code. And fork as a plugin.
On Mon, Jul 4, 2011 at 9:38 PM, Richard Vézina <[email protected]>wrote: > It surely a missing feature... > > Richard > > > On Mon, Jul 4, 2011 at 8:30 PM, Luis Goncalves <[email protected]>wrote: > >> Thanks for the links!! >> >> Django dynamic formsets seems powerful! When I first started off, I >> investigated using django, but found it very difficult. Web2py is so much >> easier to use (especially with the clear manual, and "one click" install >> with working apps ('Welcome'))!!! >> >> Maybe I'll end up contributing a friendly dynamic form creator for web2py >> ... >> >> merci, >> Luis. >> >> >> On Mon, Jul 4, 2011 at 4:54 PM, Richard Vézina < >> [email protected]> wrote: >> >>> Maybe you could find some inspiration from this project for Django : >>> >>> http://code.google.com/p/django-dynamic-formset/ >>> >>> You need to install Django to test it... >>> >>> What you seems to do is adding an arbitrary number of input for a given >>> field... >>> >>> Following good database design pratice you will normalise your schema... >>> I had try to find a solution similar to django dynamic formset, but I give >>> up in the pass. >>> >>> You have this thread that could maybe bring some answer : >>> http://groups.google.com/group/web2py/browse_thread/thread/50af0d67554c94d9/ad553c6a5514ecc7?pli=1 >>> >>> Web2py let you do this : >>> http://www.web2py.com/book/default/chapter/07?search=filter#One-form-for-multiple-tables >>> >>> But you can't have fields with the same name in your table... >>> >>> Finally it maybe possible with component now to load a arbitrary number >>> of fields inputs for a given table and with jQuery submit the differents >>> forms as one I would investigate in that direction too... >>> >>> Good luck >>> >>> Richard >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> On Mon, Jul 4, 2011 at 7:17 PM, Luis Goncalves <[email protected]>wrote: >>> >>>> Hello Richard! >>>> >>>> I looked at this, but wasn't sure how it could help -- what I need is a >>>> way for a (non-technical) admin to create profile forms with arbitrary >>>> fields (through a friendly web interface), and then users to be able to >>>> view >>>> and edit their (run-time reconfigurable) profiles. >>>> >>>> At any rate, the method I described above seems to work quite well, >>>> thanks to web2py's versatility, allowing me to define forms >>>> programmatically >>>> (excerpt below). >>>> >>>> I was wondering if there was a more clever/efficient/proper way to do >>>> so. Perhaps not! >>>> >>>> Thanks!! >>>> Luis. >>>> >>>> for field in event_fields: >>>> # see if person has a pre-defined value >>>> found = False >>>> for my_efield in me.event_field: >>>> if my_efield.display_title == field.display_title: >>>> found = True >>>> break >>>> >>>> if found: >>>> if field.data_type == 'string': >>>> new_input = INPUT(_type = field.data_type, _name = >>>> field.id, requires=IS_NOT_EMPTY(), _value=my_efield.data ) >>>> form[0].insert(-2, TR(field.display_title+':', >>>> new_input )) >>>> >>>> elif field.data_type == 'text': >>>> ..... >>>> else: >>>> if field.data_type == 'string': >>>> new_input = INPUT(_type = field.data_type, _name = >>>> field.id, requires=IS_NOT_EMPTY()) >>>> form[0].insert(-2, TR(field.display_title+':', >>>> new_input )) >>>> >>>> elif field.data_type == 'text': >>>> .... >>>> >>>> >>>> >>> >> > -- -- Bruno Rocha [ About me: http://zerp.ly/rochacbruno ] [ Aprenda a programar: http://CursoDePython.com.br ] [ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ] [ Consultoria em desenvolvimento web: http://www.blouweb.com ]

