Skip to content

Commit 89ea07b

Browse files
committed
fix: raise unknown select_related field part
1 parent 591e85a commit 89ea07b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

polymorphic/query.py

+3
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ def pivot_onto_cached_subclass(self, from_obj, obj, model_target_cls):
217217
if not isinstance(
218218
rel_iter, (VanillaRelatedPopulator, RelatedPolymorphicPopulator)
219219
):
220+
# NOTE: We don't know how to handle this type of populator!
220221
continue
221222
if rel_iter.reverse and rel_iter.model_cls is cls:
222223
if rel_iter.field.name in parents.keys():
@@ -492,6 +493,8 @@ def _convert_field_name_part(self, field_parts, model):
492493
rel_model = submodels.get(part, None)
493494
if model is not rel_model:
494495
yield from self._convert_submodel_fields_parts(next_parts, model, rel_model)
496+
else:
497+
raise
495498

496499
def _convert_submodel_fields_parts(self, field_parts, model, rel_model):
497500
field_path = list(_create_base_path(model, rel_model).split("__"))

0 commit comments

Comments
 (0)