Move comment

This commit is contained in:
Tom Christie 2014-12-10 22:10:45 +00:00
parent 9d3810f313
commit 1e336ef30d

View File

@ -89,8 +89,8 @@ class RelatedField(Field):
def get_attribute(self, instance): def get_attribute(self, instance):
if self.use_pk_only_optimization() and self.source_attrs: if self.use_pk_only_optimization() and self.source_attrs:
try:
# Optimized case, return a mock object only containing the pk attribute. # Optimized case, return a mock object only containing the pk attribute.
try:
instance = get_attribute(instance, self.source_attrs[:-1]) instance = get_attribute(instance, self.source_attrs[:-1])
return PKOnlyObject(pk=instance.serializable_value(self.source_attrs[-1])) return PKOnlyObject(pk=instance.serializable_value(self.source_attrs[-1]))
except AttributeError: except AttributeError: