From 78f5bcb5cbc9cbed6c335734e81714bc2daa294a Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 5 Dec 2014 13:07:48 +0000 Subject: Update documentation --- api-guide/serializers/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'api-guide') diff --git a/api-guide/serializers/index.html b/api-guide/serializers/index.html index 75c3f454..08a68bb0 100644 --- a/api-guide/serializers/index.html +++ b/api-guide/serializers/index.html @@ -807,9 +807,9 @@ serializer.errors # would need to be handled. profile = instance.profile - user.username = validated_data.get('username', instance.username) - user.email = validated_data.get('email', instance.email) - user.save() + instance.username = validated_data.get('username', instance.username) + instance.email = validated_data.get('email', instance.email) + instance.save() profile.is_premium_member = profile_data.get( 'is_premium_member', @@ -821,7 +821,7 @@ serializer.errors ) profile.save() - return user + return instance

Because the behavior of nested creates and updates can be ambiguous, and may require complex dependancies between related models, REST framework 3 requires you to always write these methods explicitly. The default ModelSerializer .create() and .update() methods do not include support for writable nested representations.

It is possible that a third party package, providing automatic support some kinds of automatic writable nested representations may be released alongside the 3.1 release.

-- cgit v1.2.3