Failed when lookups that span relationships with __isnull.
|Reported by:||bear330||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have two records like this:
id user name desc parent type 5, 5, 'My favorites', 'The default group of user's group.', , 1 6, 5, 'My traces', 'The default group of my traces.', 5, 2
When I query it with (user's id = 5):
[<TraceGroup: My favorites>, <TraceGroup: My traces>]
But the first record (My favorites) is not expected result for me.
I think this is because <My favorites>'s parent is null, parentparentisnull will be matched if parent is null.
I have to do this way to get correct result:
TraceGroup.objects.filter(user=user, parent__isnull=False, parent__parent__isnull=True)
Is this a bug or it should be commented at documentation?
Change History (7)
comment:1 Changed 6 years ago by mir
- milestone changed from 1.0 to 1.0 beta
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:2 Changed 6 years ago by mtredinnick
- Resolution set to wontfix
- Status changed from new to closed
comment:3 Changed 6 years ago by mtredinnick
- Resolution wontfix deleted
- Status changed from closed to reopened
comment:4 Changed 6 years ago by mtredinnick
- Resolution set to invalid
- Status changed from reopened to closed