From d4353cc1fde13352de4cfcb75d8dfe46fb54f9f2 Mon Sep 17 00:00:00 2001 From: Ion Scerbatiuc Date: Mon, 27 Jul 2015 07:57:05 -0700 Subject: [PATCH] Moved the code comment inside the if block and removed whitespace --- rest_framework/relations.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 29585a816..e1aa1439b 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -108,13 +108,11 @@ class RelatedField(Field): # Optimized case, return a mock object only containing the pk attribute. try: 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]) 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 - return PKOnlyObject(pk=value) except AttributeError: pass