Skip to content

Commit 8d4131b

Browse files
committed
Merge pull request #91 from django-json-api/bugfix-#77
Fix for issue #77. get_related_resource_type returns parent model name
2 parents 4aa6c5b + 64f8a6b commit 8d4131b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework_json_api/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ def get_related_resource_type(relation):
174174
parent_model_relation = getattr(parent_model, parent_serializer.field_name)
175175

176176
if hasattr(parent_model_relation, 'related'):
177-
relation_model = parent_model_relation.related.model
177+
relation_model = parent_model_relation.related.related_model
178178
elif hasattr(parent_model_relation, 'field'):
179-
relation_model = parent_model_relation.field.related.model
179+
relation_model = parent_model_relation.field.related_model
180180
else:
181181
raise APIException('Unable to find related model for relation {relation}'.format(relation=relation))
182182
return format_relation_name(relation_model.__name__)

0 commit comments

Comments
 (0)