Skip to content

Commit 22c5b86

Browse files
committed
More descriptive docstring on ModelSerializer
1 parent b9503cd commit 22c5b86

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rest_framework/serializers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,14 @@ class ModelSerializer(Serializer):
565565
* A set of default fields are automatically populated.
566566
* A set of default validators are automatically populated.
567567
* Default `.create()` and `.update()` implementations are provided.
568+
569+
The process of automatically determining a set of serializer fields
570+
based on the model fields is reasonably complex, but you almost certainly
571+
don't need to dig into the implemention.
572+
573+
If the `ModelSerializer` class *doesn't* generate the set of fields that
574+
you need you should either declare the extra/differing fields explicitly on
575+
the serializer class, or simply use a `Serializer` class.
568576
"""
569577
_field_mapping = ClassLookupDict({
570578
models.AutoField: IntegerField,

0 commit comments

Comments
 (0)