#12169: QuerySet method count() on models with a manytomanyfield not working in the
latest trunk
------------------------------------------+---------------------------------
Reporter: shilin | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 0 |
------------------------------------------+---------------------------------
I have a model like this:
{{{
class Thread(models.Model):
group = models.ForeignKey(Group)
creator = models.ForeignKey(Profile)
categories = models.ManyToManyField('object.Category')
}}}
you can see that it has a manytomanyfield to the model Category in the
application named object
due to the way that I'm not directly importing the model Category but use
a string instead,
the following query will return a error
{{{
Thread.objects.filter(categories__in = category_list).count()
}}}
{{{
no such column: group_thread_categories.object.category_id
}}}
as in the database level, the ORM generates a query like this
{{{
'SELECT COUNT(*) FROM "group_thread" INNER JOIN "group_thread_categories"
WHERE ("group_thread_categories"."object.category_id" IN (?))'
}}}
this bug doesn't appear in revision 9800 because i just checked out svn
today and my code starts to break.
--
Ticket URL: <
http://code.djangoproject.com/ticket/12169>
Django <
http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django updates" group.
To post to this group, send email to
django-updates@...
To unsubscribe from this group, send email to
django-updates+unsubscribe@...
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en-~----------~----~----~----~------~----~------~--~---