From fbde929b19754f19cba1d14e86f4c59f4b0a633c Mon Sep 17 00:00:00 2001 From: Ben Cail Date: Wed, 26 Oct 2022 09:58:08 -0400 Subject: Fixed #26056 -- Added QuerySet.values()/values_list() support for ArrayField's __overlap lookup. Thanks Mads Jensen and kosz85 and the initial patch. --- tests/postgres_tests/test_array.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/postgres_tests/test_array.py') diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index 89603e24a0..9e20ab3baf 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -414,6 +414,21 @@ class TestQuerying(PostgreSQLTestCase): [obj_1, obj_2], ) + def test_overlap_values(self): + qs = NullableIntegerArrayModel.objects.filter(order__lt=3) + self.assertCountEqual( + NullableIntegerArrayModel.objects.filter( + field__overlap=qs.values_list("field"), + ), + self.objs[:3], + ) + self.assertCountEqual( + NullableIntegerArrayModel.objects.filter( + field__overlap=qs.values("field"), + ), + self.objs[:3], + ) + def test_lookups_autofield_array(self): qs = ( NullableIntegerArrayModel.objects.filter( -- cgit v1.3