Almost. I get the following error when I get to appadmin:

*__init__() got an unexpected keyword argument 'format'*
*
*
My test table:

db.define_table('seafarer_education',
Field('user_id', db.auth_user, default=auth.user_id, readable=False, 
writable=False),
Field('school'),
Field('country', db.country),
Field('title'),
Field('major'),
Field('speciality'),
Field('year_from',  length = 4),
Field('year_to', length = 4),
format=lambda r: r.school
)

db.seafarer_education.country.requires=IS_IN_DB(db,'country.id',format='%(name)s',orderby=db.country.name)




On Saturday, June 15, 2013 5:30:51 PM UTC+2, Massimo Di Pierro wrote:
>
> This should do it.
>
> db.table.country.requires=IS_IN_DB(db,'country.id
> ',format='%(name)s',orderby=db.country.name)
>
>
> On Saturday, 15 June 2013 10:10:56 UTC-5, lesssugar wrote:
>>
>> I have a table 'country' storing country names. Its format is 
>>
>> format=lambda r: r.name
>>
>> I'm referencing the table in another one like this
>>
>> ...
>> Field('country', db.country)
>> ...
>>
>> When I create an update form for the second table, the Country field 
>> comes as a drop-down and it's great. However, the country names are not 
>> sorted. Is there a way to sort them on the level of defining tables or 
>> format?
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to