Hello, I'd like to get occurrence counts for my tags. I have Item and Tag models, where Item has:
tags = models.ManyToManyField(Tag) I'd like to build a query set of tags (eg. Tag.objects.filter(user=someuser) ), then get the occurrence count. The sql would be: select tag_id, count(*) from proj_item_tags where tag_id in (4,5,35) group by tag_id; I'm not quite sure how to go about this. I think I need to create a custom manager for Tag that takes the queryset and runs the sql on the ids in the queryset? The Managers documentation almost gives me what I need, but doesn't show how to get a hold of the queryset. http://docs.djangoproject.com/en/dev/topics/db/managers/ Is this the right way or is there a better way? How do I get at the queryset? Best, Parand --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---