No it is the same.

This 

    Field('owner', 'reference person')

is the same as 

    Field('owner', db.person)

If the reference field has a format='...' than you get the default 
validator:

    db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s')




On Friday, 30 August 2013 02:51:41 UTC-5, Mirko wrote:
>
> Hi all,
> I am really new to web2py and I find this python framework really exciting.
>
> I am currently reading the whole online book chapter database validators, 
> and while I was reading at the example given, I was wondering if there is a 
> difference between this :
>
> db.define_table('person', Field('name', unique=True))
> db.define_table('dog', Field('name'), Field('owner', db.person))
> db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s')
>
> and this :
>
> db.define_table('person', Field('name', unique=True), format='%(name)s')
> db.define_table('dog', Field('name'), Field('owner', type='reference 
> person', required=True))
>
> Thanks a lot,
>
> Mirko
>

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to