Skip to content

Commit

Permalink
fix: raise unknown select_related field part
Browse files Browse the repository at this point in the history
  • Loading branch information
pgammans committed Apr 4, 2024
1 parent 591e85a commit 89ea07b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions polymorphic/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def pivot_onto_cached_subclass(self, from_obj, obj, model_target_cls):
if not isinstance(
rel_iter, (VanillaRelatedPopulator, RelatedPolymorphicPopulator)
):
# NOTE: We don't know how to handle this type of populator!
continue
if rel_iter.reverse and rel_iter.model_cls is cls:
if rel_iter.field.name in parents.keys():
Expand Down Expand Up @@ -492,6 +493,8 @@ def _convert_field_name_part(self, field_parts, model):
rel_model = submodels.get(part, None)
if model is not rel_model:
yield from self._convert_submodel_fields_parts(next_parts, model, rel_model)
else:
raise

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

0 comments on commit 89ea07b

Please sign in to comment.