aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide
diff options
context:
space:
mode:
authorTom Christie2014-12-05 13:07:31 +0000
committerTom Christie2014-12-05 13:07:31 +0000
commit9fb1b396db751234a531dabacb6758ac2645776c (patch)
tree904aa49e1971c6e224a77686bdede9b7fd18047d /docs/api-guide
parentb7b0fd3e146648ba2dc03621edd979abaebcb3b3 (diff)
downloaddjango-rest-framework-9fb1b396db751234a531dabacb6758ac2645776c.tar.bz2
user in example should have been instance. Closees #2191.
Diffstat (limited to 'docs/api-guide')
-rw-r--r--docs/api-guide/serializers.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md
index 1779c863..ab44839f 100644
--- a/docs/api-guide/serializers.md
+++ b/docs/api-guide/serializers.md
@@ -326,9 +326,9 @@ Here's an example for an `update()` method on our previous `UserSerializer` clas
# 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',
@@ -340,7 +340,7 @@ Here's an example for an `update()` method on our previous `UserSerializer` clas
)
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.