Do you mean?
db.define_table('Certificate',db.Pilot,...)
On Sunday, 15 September 2013 20:25:38 UTC-5, BigBaaadBob wrote:
>
> Suppose I have a "Person" table with all the typical stuff:
>
> db.define_table('Person',
> Field('FirstName','string', length=40, notnull=True),
> Field('MiddleName','string', length=40),
> Field('LastName','string', length=40, notnull=True),
> Field('Nickname','string', length=40),
> Field('DateOfBirth','date', notnull=True),
> Field('EmployeeId','string', length=10, unique=True,required
> =True, notnull=True),
> format=lambda r: Fullname(r.FirstName, r.MiddleName, r.
> Nickname, r.LastName)
> )
>
>
> And suppose I have various special kinds of people, for exampe pilots, who
> have things that normal people don't have, like certificates or whatnot.
>
> db.define_table('Pilot',
> Field('PersonId', db.Person),
> )
>
> db.define_table('Certificate',
> Field('PilotId', db.Pilot),
> Field('TypeId', db.CertificateType),
> Field('Expires','date'),
> Field('CertificateLimitations','string', length=100),
> )
>
>
> What's the proper way to do this kind of thing in the DAL?
>
> For example:
>
>
> 1. The Pilot format should be the same as the Person format, and I'd
> like to do that without duplicating lots of tricky lambda stuff. (BTW,
> Virtual fields seem worthless for use in "format"!)
> 2. Accessing a Pilot's Person attributes should be as easy as
> accessing the Pilot's Attributes.
> 3. Requires (not shown above) should work for Pilots the same way as
> they work for Persons.
> 4. Etc.
>
> Have I strolled way off the beaten path into the muddy weeds?
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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.