Ohh ok I had no idea extensions were phone numbers, phone numbers should 
not be integers, they should be strings (otherwise how do you store the '+' 
character). Then extensions should be just this:

db.define_table('Extension',
                Field('Person' ,db.auth_user, requires =  IS_IN_DB(db,'
auth_user.id')),
                Field('Extension_number','string',required = True))

There's no need for an extension to have a supervisor, because the 
supervisor is already stored in Person. 

Then you want to get the extensions of all the supervisors? (did I get that 
right)

The easiest way would then be to use belongs:

supervisors = db(db.answer.id > 0)._select(db.auth_user.Supervisor, 
distinct=True)
supervisor_extensions = 
db(db.Extension.Person.belongs(supervisors)).select()

This way you will have the extensions of all the supervisors.

-- 
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.

Reply via email to