mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
queryset-refactor: Reworked exclude() handling to fix a few merging problems.
Fixed #6704. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7217 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -312,7 +312,7 @@ Bug #4510
|
||||
>>> Author.objects.filter(report__name='r1')
|
||||
[<Author: a1>]
|
||||
|
||||
Bug #5324
|
||||
Bug #5324, #6704
|
||||
>>> Item.objects.filter(tags__name='t4')
|
||||
[<Item: four>]
|
||||
>>> Item.objects.exclude(tags__name='t4').order_by('name').distinct()
|
||||
@@ -340,6 +340,20 @@ Similarly, when one of the joins cannot possibly, ever, involve NULL values (Aut
|
||||
>>> len([x[2][2] for x in qs.query.alias_map.values() if x[2][2] == query.LOUTER])
|
||||
1
|
||||
|
||||
The previous changes shouldn't affect nullable foreign key joins.
|
||||
>>> Tag.objects.filter(parent__isnull=True).order_by('name')
|
||||
[<Tag: t1>]
|
||||
>>> Tag.objects.exclude(parent__isnull=True).order_by('name')
|
||||
[<Tag: t2>, <Tag: t3>, <Tag: t4>, <Tag: t5>]
|
||||
>>> Tag.objects.exclude(Q(parent__name='t1') | Q(parent__isnull=True)).order_by('name')
|
||||
[<Tag: t4>, <Tag: t5>]
|
||||
>>> Tag.objects.exclude(Q(parent__isnull=True) | Q(parent__name='t1')).order_by('name')
|
||||
[<Tag: t4>, <Tag: t5>]
|
||||
>>> Tag.objects.exclude(Q(parent__parent__isnull=True)).order_by('name')
|
||||
[<Tag: t4>, <Tag: t5>]
|
||||
>>> Tag.objects.filter(~Q(parent__parent__isnull=True)).order_by('name')
|
||||
[<Tag: t4>, <Tag: t5>]
|
||||
|
||||
Bug #2091
|
||||
>>> t = Tag.objects.get(name='t4')
|
||||
>>> Item.objects.filter(tags__in=[t])
|
||||
|
||||
Reference in New Issue
Block a user