*They should be strings (otherwise how do you store the '+' character)*.

I think in this case they won't be strings since I read the numbers from a 
XML and they don't have the '+' character.

*Then you want to get the extensions of all the supervisors? *

Not all the supervisors.I want to get the extensions of a particular 
supervisor (hence I had the first and last name in the query). Something 
like this:  when a user logs in the system checks who has logged in and 
feeds a table with info(calls details,extensions,etc.) about the specific 
user, who can be a supervisor or a regular person.

quarta-feira, 16 de Setembro de 2015 às 17:09:48 UTC+1, Leonel Câmara 
escreveu:
>
> 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.auth_user.id <http://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