mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 13:54:47 +03:00
#4198: Update documentation with behaviour changes.
This commit is contained in:
parent
badf7779f2
commit
5dd336ec6c
|
@ -532,7 +532,7 @@ This option should be a list or tuple of field names, and is declared as follows
|
|||
fields = ('id', 'account_name', 'users', 'created')
|
||||
read_only_fields = ('account_name',)
|
||||
|
||||
Model fields which have `editable=False` set, and `AutoField` fields will be set to read-only by default, and do not need to be added to the `read_only_fields` option.
|
||||
Model fields which have `editable=False` set, and `AutoField` fields will be set to read-only by default, and do not need to be added to the `read_only_fields` option. Having a field listed in `read_only_fields` and declared on the class will raise an exception.
|
||||
|
||||
---
|
||||
|
||||
|
@ -570,6 +570,8 @@ This option is a dictionary, mapping field names to a dictionary of keyword argu
|
|||
user.save()
|
||||
return user
|
||||
|
||||
Having arguments for a field in `extra_kwargs` for a field declared on the class will raise an exception.
|
||||
|
||||
## Relational fields
|
||||
|
||||
When serializing model instances, there are a number of different ways you might choose to represent relationships. The default representation for `ModelSerializer` is to use the primary keys of the related instances.
|
||||
|
|
Loading…
Reference in New Issue
Block a user