﻿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
10233	X.objects.filter(...) works, X.objects.exclude(...) fails in 1.0.x	andrewl	nobody	"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.
"		closed	Database layer (models, ORM)	1.0		fixed	filter, exclude, SQL		Accepted	0	0	0	0	0	0
