That type of method will work, but it will result in a new database table 
being created for each event/custom profile. There are various alternatives 
for implementing user defined fields -- here are some Stackoverflow links:
 
http://stackoverflow.com/questions/5106335/how-to-design-a-database-for-user-defined-fields
http://stackoverflow.com/questions/4151468/how-to-store-custom-user-fields-in-database
http://stackoverflow.com/questions/2924027/db-design-to-store-custom-fields-for-a-table
 
 
Anthony

On Monday, July 4, 2011 9:19:00 PM UTC-4, rochacbruno wrote:

> 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 <ml.richa...@gmail.com>wrote:
>
>> It surely a missing feature...
>>
>> Richard 
>>
>>
>> On Mon, Jul 4, 2011 at 8:30 PM, Luis Goncalves 
>> <lu...@vision.caltech.edu>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 <ml.richa...@gmail.com>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 <lgonc...@gmail.com>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 ]
>
>

Reply via email to