mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-05-24 15:29:09 +03:00
fix(docs): fix code indentation in serializers.md
It fixes the indentation of `restore_object()` in the section "Specifying which fields should be write-only" serializers documentation.
This commit is contained in:
parent
d328f1827d
commit
b3aa512d35
|
@ -383,14 +383,14 @@ You may wish to specify multiple fields as write-only. Instead of adding each f
|
||||||
fields = ('email', 'username', 'password')
|
fields = ('email', 'username', 'password')
|
||||||
write_only_fields = ('password',) # Note: Password field is write-only
|
write_only_fields = ('password',) # Note: Password field is write-only
|
||||||
|
|
||||||
def restore_object(self, attrs, instance=None):
|
def restore_object(self, attrs, instance=None):
|
||||||
"""
|
"""
|
||||||
Instantiate a new User instance.
|
Instantiate a new User instance.
|
||||||
"""
|
"""
|
||||||
assert instance is None, 'Cannot update users with CreateUserSerializer'
|
assert instance is None, 'Cannot update users with CreateUserSerializer'
|
||||||
user = User(email=attrs['email'], username=attrs['username'])
|
user = User(email=attrs['email'], username=attrs['username'])
|
||||||
user.set_password(attrs['password'])
|
user.set_password(attrs['password'])
|
||||||
return user
|
return user
|
||||||
|
|
||||||
## Specifying fields explicitly
|
## Specifying fields explicitly
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user