For a list:integer field, you want to set IS_IN_SET(..., multiple=True) to
allow multiple values. Or perhaps you don't really want multiple values, in
which case, just make it an 'integer' field.
See
http://web2py.com/book/default/chapter/06#Many-to-Many,-list:<type>,-and-contains.
With a list:integer field, I'm not sure a > operator makes sense in a
query, as the field can contain multiple integers. Instead, maybe check
that it doesn't contain 0:
~db.my_table.rank.contains(0)
Anthony
On Monday, December 5, 2011 6:25:31 AM UTC-5, thodoris 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 ???
>
>