1
- import django .db .models .base as base
2
1
from django .db import NotSupportedError
3
- from django .db .models .constants import LOOKUP_SEP
4
2
from django .db .models .fields .related_lookups import In , RelatedIn
5
3
from django .db .models .lookups import (
6
4
BuiltinLookup ,
10
8
UUIDTextMixin ,
11
9
)
12
10
13
- from .fields import EmbeddedModelField
14
11
from .query_utils import process_lhs , process_rhs
15
12
16
13
@@ -124,26 +121,6 @@ def uuid_text_mixin(self, compiler, connection): # noqa: ARG001
124
121
raise NotSupportedError ("Pattern lookups on UUIDField are not supported." )
125
122
126
123
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
-
147
124
def register_lookups ():
148
125
BuiltinLookup .as_mql = builtin_lookup
149
126
FieldGetDbPrepValueIterableMixin .resolve_expression_parameter = (
@@ -154,4 +131,3 @@ def register_lookups():
154
131
IsNull .as_mql = is_null
155
132
PatternLookup .prep_lookup_value_mongo = pattern_lookup_prep_lookup_value
156
133
UUIDTextMixin .as_mql = uuid_text_mixin
157
- base .Options = Options
0 commit comments