[web2py] Re: two references from one table to another.

2012-07-20 Thread Ashraf Mansour
I love both, you and web2py. Regards, > >> Ashraf >> > --

[web2py] Re: two references from one table to another.

2012-07-20 Thread Massimo Di Pierro
Sorry, it took me a while to understand your question. But you actually have a very good question. Here is how you do it: db=DAL() db.define_table('auth_user', Field('name')) db.define_table('message', Field('to_user',db.auth_user), Field('from_user

[web2py] Re: two references from one table to another.

2012-07-20 Thread Ashraf Mansour
is the question too easy or too difficult ? > > Ashraf > --

[web2py] Re: two references from one table to another.

2012-07-20 Thread Ashraf Mansour
> > Thank you for your time. > But unfortunately, I don't understand. maybe the question is not clear enough. the query will be like *( db.from_to.from_user == db.auth_user.id ) & ( db.from_to.to_user == db.auth_user.id )* How to select the two names? both are * db.auth_user.name* --

[web2py] Re: two references from one table to another.

2012-07-20 Thread Cliff Kachinske
Let's say your table name is from_to. Then you have something like arbitrary_last_name = 'Smith' # make this assignment at run time query = ( (db.auth_user.last_name==arbitrary_last_name) & (db.auth_user.id==db.from_to.from_user) & (db.from_to.to_user==db.auth_user.id) ) db(query).select(db