mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Refs #33482 -- Fixed QuerySet selecting and filtering againts Exists() with empty queryset.
Thanks Tobias Bengfort for the report.
This commit is contained in:
parent
0989cf13e7
commit
ea596a52d9
2 changed files with 17 additions and 0 deletions
|
@ -2294,6 +2294,14 @@ class ExistsTests(TestCase):
|
|||
self.assertSequenceEqual(qs, [manager])
|
||||
self.assertIs(qs.get().not_exists, True)
|
||||
|
||||
def test_filter_by_empty_exists(self):
|
||||
manager = Manager.objects.create()
|
||||
qs = Manager.objects.annotate(exists=Exists(Manager.objects.none())).filter(
|
||||
pk=manager.pk, exists=False
|
||||
)
|
||||
self.assertSequenceEqual(qs, [manager])
|
||||
self.assertIs(qs.get().exists, False)
|
||||
|
||||
|
||||
class FieldTransformTests(TestCase):
|
||||
@classmethod
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue