Missed "%":

'%(name)s'

It's kinda comforting that the Framefork Creator makes mistakes also ;))

Of course, thanks for help.


On Saturday, June 15, 2013 6:35:12 PM UTC+2, Massimo Di Pierro wrote:
>
> My bad. Try this
>
> db.seafarer_education.country.requires=IS_IN_DB(db,'country.id
> ','(name)s',orderby=db.country.name)
>
> On Saturday, 15 June 2013 11:07:01 UTC-5, lesssugar wrote:
>>
>> 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)
>>
>> Must add the table is created in a separate model (so not db.py). Not 
>> sure if it's an issue here.
>>
>>
>> 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