[web2py] Re: Self-referencing tables and queries

2015-09-17 Thread Carla Raquel
*So what? You should future proof the app. Some day there might be extensions in India or something.* Actually, the extensions are internal to the company, either phone numbers or mobile numbers, so your scenario won't ever apply. *Do you mean the extensions of the persons he supervises?*

Re: [web2py] Re: Self-referencing tables and queries

2015-09-17 Thread António Ramos
+1 *There's no need for an extension to have a supervisor, because the supervisor is already stored in Person. !!!* 2015-09-17 11:10 GMT+01:00 Carla Raquel : > *So what? You should future proof the app. Some day there might be > extensions in India or something.* > >

[web2py] Re: Self-referencing tables and queries

2015-09-17 Thread Leonel Câmara
> Actually, the extensions are internal to the company, either phone numbers or mobile numbers, so your scenario won't ever apply. Fine, I disagree with this assumption but I'm not your client. > Conclusion: Just the Supervisor extensions Well this is very easy, the Supervisor is just a

[web2py] Re: Self-referencing tables and queries

2015-09-16 Thread Leonel Câmara
This is the answer to the first problem: db.auth_user.Supervisor.requires=IS_EMPTY_OR(IS_IN_DB(db,'auth_user.id', db.auth_user._format)) You can just remove it as it will use the format for auth_user anyway as that's the default. So it becomes only:

[web2py] Re: Self-referencing tables and queries

2015-09-16 Thread Carla Raquel
I guess my code is more messed up than I thought. I'll try and clarify your points: *What am I trying to achieve?* In the db there are people (given by the auth_user table). From those people there are ones who are hierarchically above them and supervise them.They are called Supervisors. All

[web2py] Re: Self-referencing tables and queries

2015-09-16 Thread Carla Raquel
*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

[web2py] Re: Self-referencing tables and queries

2015-09-16 Thread Leonel Câmara
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 =

[web2py] Re: Self-referencing tables and queries

2015-09-16 Thread Dave S
On Wednesday, September 16, 2015 at 10:15:53 AM UTC-7, Leonel Câmara wrote: > > > 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 > > So what? You should future proof the app. Some day there might be > extensions in India

[web2py] Re: Self-referencing tables and queries

2015-09-16 Thread Leonel Câmara
> 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 So what? You should future proof the app. Some day there might be extensions in India or something. > Not all the supervisors.I want to get the extensions of a particular