We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0386a01 commit d4353ccCopy full SHA for d4353cc
rest_framework/relations.py
@@ -108,13 +108,11 @@ def get_attribute(self, instance):
108
# Optimized case, return a mock object only containing the pk attribute.
109
try:
110
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
114
value = instance.serializable_value(self.source_attrs[-1])
115
if is_simple_callable(value):
+ # Handle edge case where the relationship `source` argument
+ # points to a `get_relationship()` method on the model
116
value = value().pk
117
118
return PKOnlyObject(pk=value)
119
except AttributeError:
120
pass
0 commit comments