Hello,

please, for a given tag T, how to get all the other tags of all the
items tagged with T? And sorted by tag usage? And not just for one tag
T but for many?

Or, in another words: "what other tags are associated with documents
that are associated to my tag"?

Or, in another words: "a list of tags related to a given list of tags
- that is, other tags used by items which have some of [was: "all"]
the given tags"?

I found several solutions, unfortunately none of them doing exactly
what I would like to have:

- The most natural one:
Tag.objects.filter(document__tags__name='mytag').exclude(name='mytag').distinct()
Unfortunately, this doesn't work for me. No "GROUP BY", its not sorted
and can't query for more than one tag.

- "Related tags query, many-to-many double join":
http://groups.google.com/group/django-users/browse_thread/thread/9f17b7fe05c8091f/
I like this very much, however it works with just one tag as well.
Could it be possible to add support for several source tags? And so
many INNER JOIN, wouldn't it be a bit too slow?

- "django-tagging":
http://code.google.com/p/django-tagging/source/browse/trunk/tagging/models.py#145
It probably does almost everything I want but I'm unable to get what
the code is doing. And I need to because it seems to me that it asks
for items which have to have *all* the given tags, whereas for me, it
would be ok to ask for the items which have just *some* of the given
tags.

Well, if you are still with me, thanks. Any idea how to approach this?
Hint? Help?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to