We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bba4f6e commit 9edff42Copy full SHA for 9edff42
rest_framework_json_api/serializers.py
@@ -192,8 +192,8 @@ def to_representation(self, instance):
192
def _get_field_representation(self, field, instance):
193
request = self.context.get('request', None)
194
is_included = field.source in get_included_resources(request)
195
- if not is_included and isinstance(field, ModelSerializer) and hasattr(instance, f'{field.source}_id'):
196
- attribute = getattr(instance, f'{field.source}_id')
+ if not is_included and isinstance(field, ModelSerializer) and hasattr(instance, field.source + '_id'):
+ attribute = getattr(instance, field.source + '_id')
197
198
if attribute is None:
199
return None
0 commit comments