items = db(dd.posts.relations.category==db.categories.id).select()
for item in items:
    print item.posts.id,'belongs',item.categories.title

On Oct 6, 8:23 pm, Mengu <whalb...@gmail.com> wrote:
> massimo,
>
> actually this wasn't what i am asking, but thank you for showing
> another way for it. i have my controller named as "post" and i have
> the action "view". i currently have my routes_in like the 
> following:http://mengu.pastebin.com/m698f1726this is working very well however
> please let me know if this is not necessary or a proper way.
>
> any recommendations on the query?http://mengu.pastebin.com/m111e1a47
> i could make something like:
> posts = db().select(db.posts.ALL)
> postcategories = {}
> for post in posts:
>     postcategories[post.id] = {}
>     for relation in post.relations.select():
>         category = db.categories[relation.category]
>         postcategories[post.id][category.id] = category.title
>
> however this makes tons of queries for each post which is something i
> really don't want.
>
> ----
>
> dear alvaro,
>
> i ofcourse would like to produce the software with you, i'd enjoy
> that. however i currently have my time very lack so i'm not working on
> the product all the time.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to