> so if category_id 2 name is 'politics' it would know that it occurs 3 > times. make sense? The easy way would be to create a counter field in > the categories table and count each time that the category is being > used but that is redundant and require extra work to save the category > count each time I add a new entry. The answer is already there I just > need to figure out how to retrieve that answer. :)
You didn't include your full model, but have you tried something like this? Blog.objects.filter(categories__name='politics').distinct().count() This assumes that Blog.categories is your M2M field. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---