Skip to content

Commit a775af8

Browse files
committed
Remove the patched options
1 parent 9e6c6e5 commit a775af8

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

django_mongodb_backend/indexes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def get_pymongo_index_model(
156156
for field_name, _ in self.fields_orders:
157157
field = model._meta.get_field(field_name)
158158
type_ = self.search_index_data_types(field.db_type(schema_editor.connection))
159-
field_path = column_prefix + get_column_path(model, field_name)
159+
field_path = column_prefix + get_column_path(model, field_name).column
160160
fields[field_path] = {"type": type_}
161161
return SearchIndexModel(
162162
definition={"mappings": {"dynamic": False, "fields": fields}}, name=self.name
@@ -266,7 +266,7 @@ def get_pymongo_index_model(
266266
fields = []
267267
for field_name, _ in self.fields_orders:
268268
field_ = model._meta.get_field(field_name)
269-
field_path = column_prefix + get_column_path(model, field_name)
269+
field_path = column_prefix + get_column_path(model, field_name).column
270270
mappings = {"path": field_path}
271271
if isinstance(field_, ArrayField):
272272
mappings.update(

django_mongodb_backend/lookups.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import django.db.models.base as base
21
from django.db import NotSupportedError
3-
from django.db.models.constants import LOOKUP_SEP
42
from django.db.models.fields.related_lookups import In, RelatedIn
53
from django.db.models.lookups import (
64
BuiltinLookup,
@@ -10,7 +8,6 @@
108
UUIDTextMixin,
119
)
1210

13-
from .fields import EmbeddedModelField
1411
from .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-
147124
def 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

Comments
 (0)