diff options
Diffstat (limited to 'api-guide/serializers/index.html')
| -rw-r--r-- | api-guide/serializers/index.html | 8 |
1 files changed, 4 insertions, 4 deletions
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 </code></pre> <p>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 <code>ModelSerializer</code> <code>.create()</code> and <code>.update()</code> methods do not include support for writable nested representations.</p> <p>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.</p> |
