File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 5
5
6
6
from django .core .exceptions import FieldError
7
7
from django .db import connection
8
+ from django .db .models .expressions import Exists , OuterRef
8
9
from django .db .models .functions import Substr
9
10
from django .test import TestCase , skipUnlessDBFeature
10
11
@@ -932,3 +933,12 @@ def test_custom_lookup_none_rhs(self):
932
933
field = query .model ._meta .get_field ('nulled_text_field' )
933
934
self .assertIsInstance (query .build_lookup (['isnull_none_rhs' ], field , None ), IsNullWithNoneAsRHS )
934
935
self .assertTrue (Season .objects .filter (pk = season .pk , nulled_text_field__isnull_none_rhs = True ))
936
+
937
+ def test_exact_exists (self ):
938
+ qs = Article .objects .filter (pk = OuterRef ('pk' ))
939
+ seasons = Season .objects .annotate (
940
+ pk_exists = Exists (qs ),
941
+ ).filter (
942
+ pk_exists = Exists (qs ),
943
+ )
944
+ self .assertCountEqual (seasons , Season .objects .all ())
You can’t perform that action at this time.
0 commit comments