Skip to content

Commit 9edff42

Browse files
author
Tim Csitkovics
committed
Make compatible with Python 2.X
1 parent bba4f6e commit 9edff42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework_json_api/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ def to_representation(self, instance):
192192
def _get_field_representation(self, field, instance):
193193
request = self.context.get('request', None)
194194
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')
195+
if not is_included and isinstance(field, ModelSerializer) and hasattr(instance, field.source + '_id'):
196+
attribute = getattr(instance, field.source + '_id')
197197

198198
if attribute is None:
199199
return None

0 commit comments

Comments
 (0)