﻿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
12598	somefield__isnull=False produce wrong SQL	benc		"Hi

I have two models Model1 Model2, extending another model Model0(not abstract).
I'm trying query Model0 and to filter only the models that have relation to Model1


{{{
objects = list(Model0.objects.filter(model2__isnull=False)
}}}

which result with a SQL

{{{
WHERE ""myapp_model0"".""id"" IS NOT NULL
}}}



{{{
objects = list(Model0.objects.filter(model2__isnull=True)
}}}

which result with a SQL

{{{
WHERE ""myapp_model2"".""model0_ptr_id"" IS NULL'
}}}


The first SQL and the second is right.
When using ~Q to negate the second I get what I want.

Thanks
"		closed	Database layer (models, ORM)	1.1		duplicate			Unreviewed	0	0	0	0	0	0
