#12598: somefield__isnull=False produce wrong SQL
-----------------------------+----------------------------------------------
Reporter: benc | Owner:
Status: new | Milestone:
Component: ORM aggregation | Version: 1.1
Keywords: | Stage: Unreviewed
Has_patch: 0 |
-----------------------------+----------------------------------------------
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
--
Ticket URL: <http://code.djangoproject.com/ticket/12598>
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.