1- import django .db .models .base as base
21from django .db import NotSupportedError
3- from django .db .models .constants import LOOKUP_SEP
42from django .db .models .fields .related_lookups import In , RelatedIn
53from django .db .models .lookups import (
64 BuiltinLookup ,
108 UUIDTextMixin ,
119)
1210
13- from .fields import EmbeddedModelField
1411from .query_utils import process_lhs , process_rhs
1512
1613
@@ -124,26 +121,6 @@ def uuid_text_mixin(self, compiler, connection): # noqa: ARG001
124121 raise NotSupportedError ("Pattern lookups on UUIDField are not supported." )
125122
126123
127- class Options (base .Options ):
128- def get_field (self , field_name ):
129- if LOOKUP_SEP in field_name :
130- previous = self
131- keys = field_name .split (LOOKUP_SEP )
132- path = []
133- for field in keys :
134- field = base .Options .get_field (previous , field )
135- if isinstance (field , EmbeddedModelField ):
136- previous = field .embedded_model ._meta
137- else :
138- previous = field
139- path .append (field .column )
140- column = "." .join (path )
141- embedded_column = field .clone ()
142- embedded_column .column = column
143- return embedded_column
144- return super ().get_field (field_name )
145-
146-
147124def register_lookups ():
148125 BuiltinLookup .as_mql = builtin_lookup
149126 FieldGetDbPrepValueIterableMixin .resolve_expression_parameter = (
@@ -154,4 +131,3 @@ def register_lookups():
154131 IsNull .as_mql = is_null
155132 PatternLookup .prep_lookup_value_mongo = pattern_lookup_prep_lookup_value
156133 UUIDTextMixin .as_mql = uuid_text_mixin
157- base .Options = Options
0 commit comments