No but you can do:
select_data = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')]
r = dict((x[1],x[0]) for x in select_data)
form=SQLFORM.factory(Field('selector',requires=IS_IN_SET(select_data),
default=r['NURSERY']))
On Feb 25, 9:08 pm, Rupesh Pradhan <[email protected]> wrote:
> form=SQLFORM.factory(Field('selector',requires=IS_IN_SET(select_data),defau
> lt=2))
>
> That works fine, however if i have my select_data as given below
>
> select_data = [(1, 'NURSERY'), (2, 'LKG'), (3, 'UKG'), (4, '1')]
>
> The code works fine.
>
> Is there a way (in fact, is there a need?) to make the default work this
> way?
>
> form=SQLFORM.factory(Field('selector',requires=IS_IN_SET(select_data),defau
> lt='NURSERY'))
>
> The above code does not work, of course.