Commit d4353cc1 by Ion Scerbatiuc

Moved the code comment inside the if block and removed whitespace

parent 0386a016
...@@ -108,13 +108,11 @@ class RelatedField(Field): ...@@ -108,13 +108,11 @@ class RelatedField(Field):
# Optimized case, return a mock object only containing the pk attribute. # Optimized case, return a mock object only containing the pk attribute.
try: try:
instance = get_attribute(instance, self.source_attrs[:-1]) instance = get_attribute(instance, self.source_attrs[:-1])
# Handle edge case where the relationship `source` argument
# points to a `get_relationship()` method on the model
value = instance.serializable_value(self.source_attrs[-1]) value = instance.serializable_value(self.source_attrs[-1])
if is_simple_callable(value): if is_simple_callable(value):
# Handle edge case where the relationship `source` argument
# points to a `get_relationship()` method on the model
value = value().pk value = value().pk
return PKOnlyObject(pk=value) return PKOnlyObject(pk=value)
except AttributeError: except AttributeError:
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment