Thinking of ditching MANY-MANY altogether, I have come up with this
approach which uses multiple=True-

http://web2py.pastebin.com/813ZELF5

However, the problem is that whenever I do something like
snippet.tags, it just gives me a string list with the IDs. How do I
make it give me a list of the tags associated with the record so that
I can access the name field with something like-

for tag in snippet.tags:
    print tag.name

??

On Apr 5, 6:46 pm, Ishbir <[email protected]> wrote:
> I've got some problem with the MANY-MANY relation in Web2Py. This is
> my code-
>
> http://pastie.textmate.org/903738
>
> Now, the problem is that the query returns only those records which
> have tags, not the ones without them. However, if I specify query|
> db.snippets.id>0 or anything, it gives me garbled results with all the
> tables mixed up and nothing right..
>
> Is there any way around this? I thought about using the tagging plugin
> but the issue is that I don't think it would be very efficient since I
> need to also display the tags on the index page and that would result
> in n+1 queries where n is the no. of snippets. Or I am just getting
> apprehensive and it will just take 2-3 queries to get the tags of
> snippet?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to