Aren't you setting a field constraint that allows only integers from 0
to 5?

> featured = (0,1,2,3,4,5)

IS_IN_SET has a multiple=True/False argument (false by default) that
allows to validate sequences of objects (for example [int a, int
b, ... int n])

Also you can set a default value in the Field call

Field(..., default = [obj a, obj b, ... ])

On Dec 5, 8:25 am, thodoris <[email protected]> wrote:
> I have the following
>
> featured = (0,1,2,3,4,5)
>
> Field('rank','list:integer',requires=IS_IN_SET(featured, zero='rank'),
> readable=False, writable=False),
>
> So this field can only be set from appadmin and is set by default to
> [] when a record is made, IIUC.
>
> I want to select the tables that have been seti to something in
> admin,  so i do the following
>
> tables = db(db.my_table.rank >
> [0]).select(orderby=db.my_table.featured_rank)
>
> but tables also contains the entries that have the default value []
>
> What am i doing wrong?
>
> Also can i set a default value to my field ???

Reply via email to