[web2py] Re: denormalizing a list:reference -- need a bit of help

2012-09-12 Thread Pepe Araya
Thanks you! On Wednesday, September 12, 2012 6:51:56 AM UTC-3, Niphlod wrote: > > no, it wont. > users is a "list" of users. > you need to fetch the "list of entities" separately for every "item" of > the "list of the users". > > Il giorno mercoledì 12 settembre 2012 11:46:32 UTC+2, Pepe Araya ha

[web2py] Re: denormalizing a list:reference -- need a bit of help

2012-09-12 Thread Niphlod
no, it wont. users is a "list" of users. you need to fetch the "list of entities" separately for every "item" of the "list of the users". Il giorno mercoledì 12 settembre 2012 11:46:32 UTC+2, Pepe Araya ha scritto: > > Thanks very much! it works! > > if I have the user query in the controller lik

[web2py] Re: denormalizing a list:reference -- need a bit of help

2012-09-12 Thread Pepe Araya
Thanks very much! it works! if I have the user query in the controller like this: def user_list(): users = db(db.auth_user).select() entities = db(db.entity.id.belongs(user.entity)).select(db.entity.name) return dict(users = users, entities = entities ) will work? --- Another related quest

[web2py] Re: denormalizing a list:reference -- need a bit of help

2012-09-12 Thread Niphlod
more or less {{for user in db(db.auth_user).select():}} Name : {{=user.name}} {{entities = db(db.entity.id.belongs(user.entity)).select(db.entity. name)}} Entities : {{', '.join(ent.name for ent in entities)}} {{pass}} -- of course you should probably fetch the result in the contro

[web2py] Re: denormalizing a list:reference -- need a bit of help

2012-09-12 Thread Pepe Araya
Hi, a question: how do you display the entities related to a user in a View which displays a list of users with their related entities?? for example: Name: user 1 Entities: one, two -- Name: user 2 Entities: one -- ... Thanks. On Friday, May 11, 2012 12:16:32 PM UTC-4, Niphlod wrote: > > If

[web2py] Re: denormalizing a list:reference -- need a bit of help

2012-05-11 Thread Niphlod
If you need to fetch all entities knowing the user in advance there is a ultra-simple way to fetch entities in a single query Actually I don't think anyone will come up with a solution involving more than 1 additional query to the one required for "selecting" the user. user = db.auth_user(au