aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/serializers.py
diff options
context:
space:
mode:
authorTom Christie2013-10-17 07:59:29 -0700
committerTom Christie2013-10-17 07:59:29 -0700
commit2394f05e5a0a566366b066081002bfcf9a290589 (patch)
tree6e7f0ab3cbc7417bfe719c752e5724008d189475 /rest_framework/serializers.py
parent6a40202a644055808bde355471b1400264d0dada (diff)
parent86ea969e1154de20a53fc5b853e8340508648e98 (diff)
downloaddjango-rest-framework-2394f05e5a0a566366b066081002bfcf9a290589.tar.bz2
Merge pull request #1170 from craigds/write-into-foreignkey-with-source
fix writing into foreign key with non-null source
Diffstat (limited to 'rest_framework/serializers.py')
-rw-r--r--rest_framework/serializers.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 05c9eb47..4210d058 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -406,7 +406,7 @@ class BaseSerializer(WritableField):
return
# Set the serializer object if it exists
- obj = getattr(self.parent.object, field_name) if self.parent.object else None
+ obj = get_component(self.parent.object, self.source or field_name) if self.parent.object else None
obj = obj.all() if is_simple_callable(getattr(obj, 'all', None)) else obj
if self.source == '*':