On Saturday, July 8, 2017 at 4:54:51 PM UTC-4, Filipe Reis wrote:
>
> I was trying to implement this but I can't understand one thing.
>
> In this example:
>
> db.define_table('abonent', Field('a'))
> db.define_table('person', db.abonet, Field('b')) # has a,b
> db.define_table('company', db.abonet, Field('c')) # has a,c
>
>
> You would create many persons and companies, how would you select them all
> from the abonent? Since I tried it and the abonent table will be empty...
>
> For example:
>
> some table 1------n abonent , and that abonent is either a person or a
> company.
>
The above code simply creates db.person and db.company tables that have the
same fields as the db.abonent table. However, records in the three tables
are separate -- a record in the db.person table does not also appear in the
db.abonet table. If you want a single collection of records that can have
different types, you should probably just have a single table with some
kind of "type" field.
Anthony
--
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/d/optout.