﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12169	QuerySet method count() on models with a manytomanyfield not working in the latest trunk	shilin	nobody	"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.


"		closed	Database layer (models, ORM)	dev		fixed			Unreviewed	0	0	0	0	0	0
