diff options
| author | Xavier Ordoquy | 2014-03-03 11:41:07 +0100 |
|---|---|---|
| committer | Xavier Ordoquy | 2014-03-03 11:41:07 +0100 |
| commit | 3d7cb72e0a770595d8934b731f9c462b839f941a (patch) | |
| tree | 809035a13a8de89d020ffefea38f779bfa4a7ed3 /docs/api-guide/serializers.md | |
| parent | b2f0f4fcf49d457aefc21960f62fcb8f2cf6770d (diff) | |
| parent | ee9864e0dce10018261c131a76eb7c668703d76c (diff) | |
| download | django-rest-framework-3d7cb72e0a770595d8934b731f9c462b839f941a.tar.bz2 | |
Merge remote-tracking branch 'reference/master' into feature/django_1_7
Diffstat (limited to 'docs/api-guide/serializers.md')
| -rw-r--r-- | docs/api-guide/serializers.md | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index e8369c20..7ee060af 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -161,7 +161,7 @@ To do any other validation that requires access to multiple fields, add a method """ Check that the start is before the stop. """ - if attrs['start'] < attrs['finish']: + if attrs['start'] > attrs['finish']: raise serializers.ValidationError("finish must occur after start") return attrs @@ -383,14 +383,14 @@ You may wish to specify multiple fields as write-only. Instead of adding each f fields = ('email', 'username', 'password') write_only_fields = ('password',) # Note: Password field is write-only - def restore_object(self, attrs, instance=None): - """ - Instantiate a new User instance. - """ - assert instance is None, 'Cannot update users with CreateUserSerializer' - user = User(email=attrs['email'], username=attrs['username']) - user.set_password(attrs['password']) - return user + def restore_object(self, attrs, instance=None): + """ + Instantiate a new User instance. + """ + assert instance is None, 'Cannot update users with CreateUserSerializer' + user = User(email=attrs['email'], username=attrs['username']) + user.set_password(attrs['password']) + return user ## Specifying fields explicitly |
