Cool. I tried that early and it didn't work. I just tried it again and it seems to work. must of keyed something in wrong.
>>> Weblog.objects.filter(category__id='1').count() 3L Thanks for your help. On Jan 25, 2:08 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > On Jan 25, 2:01 pm, Chris <[EMAIL PROTECTED]> wrote: > > > Cool here is my models and I posted an sql query to: > > > Modelshttp://dpaste.com/32548/ > > > SQL Queries (posted a question in this one)http://dpaste.com/32552/ > > > Hope this helps. maybe there is a better way of doing what I am trying > > to do. > > Is this a fair characterisation of what you are trying to do? Given a > category title or id, you want to get the total number of Weblog > objects which have that category. > > If yes, what do you get if you drop into the shell and run any of > these queries? > > Weblog.objects.filter(category__title='programming').count() > > or > > Weblog.objects.filter(category__id=1).count() > > or > > c = Category.objects.get(id=1) > c.weblog.count() --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---