mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 00:19:53 +03:00
Docs updated
This commit is contained in:
parent
c8af10349d
commit
33d48041b8
|
@ -243,6 +243,16 @@ The `RelatedField` class may be subclassed to create a custom representation of
|
||||||
|
|
||||||
All the relational fields may be used for any relationship or reverse relationship on a model.
|
All the relational fields may be used for any relationship or reverse relationship on a model.
|
||||||
|
|
||||||
|
## Reverse relational fields
|
||||||
|
|
||||||
|
By default reverse relational fields are not displayed when ModelSerializer is used. You can control this behavior by using `INCLUDE_REVERSE_RELATIONS` setting.
|
||||||
|
|
||||||
|
Besides global setting you can also use model specific setting:
|
||||||
|
|
||||||
|
class BlogPostSerializer(serializer.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
include_reverse_relations = True
|
||||||
|
|
||||||
## Specifying which fields should be included
|
## Specifying which fields should be included
|
||||||
|
|
||||||
If you only want a subset of the default fields to be used in a model serializer, you can do so using `fields` or `exclude` options, just as you would with a `ModelForm`.
|
If you only want a subset of the default fields to be used in a model serializer, you can do so using `fields` or `exclude` options, just as you would with a `ModelForm`.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user