[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-07 Thread brushek
Thank You Massimo, it's enaugh for me - indeed, the code is rather simple. Regards and good luck :) brushek W dniu wtorek, 7 stycznia 2014 09:09:04 UTC+1 użytkownik Massimo Di Pierro napisał: > > This is the source for SQLFORM.dictform: > > def dictform(dictionary, **kwargs): > fields =

[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-07 Thread Massimo Di Pierro
This is the source for SQLFORM.dictform: def dictform(dictionary, **kwargs): fields = [] for key, value in sorted(dictionary.items()): t, requires = SQLFORM.AUTOTYPES.get(type(value), (None, None)) if t: fields.append(Field(key, t, requires=r

[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-05 Thread brushek
Thank You Masimo for answer, Hm... so this is huge problem for me, because I have in dict many other options (I showed only one field to show the problem). Is there any easy way to append or insert Field (with corect select option generated in the view) to the form created by SQLFORM.dictform ?

[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-05 Thread Massimo Di Pierro
Unfortunately dictform does not support this. You can do: session.config = dict(NAME = 'a') form = SQLFORM.factory(Field('NAME',default=session.config['NAME'],requires=IS_IN_SET(('a','b','c','d','e'), error_message="Choose between a and e"))) if form.process().accepted: session.config

[web2py] Re: IS_IN_SET in SQLFORM.dictform

2014-01-05 Thread brushek
Hi, I'm still searching, and I found in the web2py book something like this in widget section: The "options" widget is used when a field's requires is IS_IN_SET or IS_IN_DB with multiple=False (default behavior). I assumed, that if I change the 'requires' of field (after SQLFORM.dictform, s