Opened 16 years ago
Last modified 16 years ago
#10233 closed
X.objects.filter(...) works, X.objects.exclude(...) fails in 1.0.x — at Version 1
Reported by: | andrewl | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.0 |
Severity: | Keywords: | filter, exclude, SQL | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
While an X.objects.filter(...) works, the equivalent X.objects.exclude(...) fails under Django 1.0.x.
The exclusion condition seems to need at least 3 levels of 'redirection' (for want of a better term) for the failure to occur. For example:
X.objects.exclude(a='foo') -- OK X.objects.exclude(a__b='foo') -- OK X.objects.exclude(a__b__c='foo') -- FAIL
The equivalent X.objects.filter(...) succeeds. Also I have not tested higher levels of redirection than 3.
Note that this appears to be fixed in Django TRUNK (which was at revision 9821 at the time of submitting this ticket).
Please refer to the attached file for a concrete query example showing the SQL produced under Django 1.0.x (tagged releases 1.0 and 1.0.2 tested) and Django TRUNK.
Django v1.0.x SQL and error traceback vs Django Trunk SQL