1
0
mirror of https://github.com/django/django.git synced 2025-03-06 15:32:33 +00:00

[5.2.x] Refs #34975 -- Removed unnecessary lookups.In.get_refs().

Now that In.get_source_expression() includes its right-hand-side when it
contains expressions (refs #36025) it no longer requires a specialized
get_refs() method.

Backport of 0bac41fc7e4a842e8d20319cba31cc645501c245 from main.
This commit is contained in:
Simon Charette 2024-12-22 23:23:28 -05:00 committed by Sarah Boyce
parent d99985bbc1
commit 0690c06013

View File

@ -514,14 +514,6 @@ class IntegerLessThanOrEqual(IntegerFieldOverflow, LessThanOrEqual):
class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup): class In(FieldGetDbPrepValueIterableMixin, BuiltinLookup):
lookup_name = "in" lookup_name = "in"
def get_refs(self):
refs = super().get_refs()
if self.rhs_is_direct_value():
for rhs in self.rhs:
if get_rhs_refs := getattr(rhs, "get_refs", None):
refs |= get_rhs_refs()
return refs
def get_prep_lookup(self): def get_prep_lookup(self):
from django.db.models.sql.query import Query # avoid circular import from django.db.models.sql.query import Query # avoid circular import