A quick (and maybe vague) response:

mylist = ["apples", "oranges", "bananas", "cows"]

# assuming there is a string myfield defined in the model
db.mytable.myfield.requires=IS_IN_SET(mylist)

Note: validators can be set in an action basis, for example, for a given 
form, they are configurable with options, and you can customize them with 
special features:
http://web2py.com/books/default/chapter/29/7?search=is_in_set#Custom-validators</>

It is possible also to customize the widgets used by default with the 
validators for more sophisticated interfaces:
http://web2py.com/books/default/chapter/29/7?search=is_in_set#Widgets </>

The API with more info
http://www.web2py.com/examples/static/epydoc/web2py.gluon.validators.IS_IN_SET-class.html

For simple and excellent examples check the official web2py book at 

http://web2py.com/books/default/chapter/29/7?search=is_in_set#Validators

On Saturday, May 5, 2012 10:26:28 AM UTC-3, novice007 wrote:
>
> I come from the django background and wanted to play around with web2py. 
> There is an awesome feature in django model forms, the analogous to SQL 
> Forms in web2py. 
> The feature which i want to implement in web2py is 
> this<https://docs.djangoproject.com/en/dev/ref/forms/widgets/#setting-arguments-for-widgets>
> .
>
> I tried searching for stuff, but the solutions were more complicated, i 
> have posted a SO question 
> here<http://stackoverflow.com/questions/10460973/select-widget-model-form-with-static-content-from-a-list-in-web2py>
> . 
>

Reply via email to