Skip to content

Commit d4353cc

Browse files
committed
Moved the code comment inside the if block and removed whitespace
1 parent 0386a01 commit d4353cc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

rest_framework/relations.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,11 @@ def get_attribute(self, instance):
108108
# Optimized case, return a mock object only containing the pk attribute.
109109
try:
110110
instance = get_attribute(instance, self.source_attrs[:-1])
111-
112-
# Handle edge case where the relationship `source` argument
113-
# points to a `get_relationship()` method on the model
114111
value = instance.serializable_value(self.source_attrs[-1])
115112
if is_simple_callable(value):
113+
# Handle edge case where the relationship `source` argument
114+
# points to a `get_relationship()` method on the model
116115
value = value().pk
117-
118116
return PKOnlyObject(pk=value)
119117
except AttributeError:
120118
pass

0 commit comments

Comments
 (0)