mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 16:40:03 +03:00
Clear Sphinx warnings from serializers.
Cleared Sphinx warnings from: - ModelSerializer.create - BaseSerializer.many_init
This commit is contained in:
parent
c62e3ca764
commit
b19acb4abb
|
@ -136,7 +136,7 @@ class BaseSerializer(Field):
|
||||||
|
|
||||||
Note that we're over-cautious in passing most arguments to both parent
|
Note that we're over-cautious in passing most arguments to both parent
|
||||||
and child classes in order to try to cover the general case. If you're
|
and child classes in order to try to cover the general case. If you're
|
||||||
overriding this method you'll probably want something much simpler, eg:
|
overriding this method you'll probably want something much simpler, eg::
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def many_init(cls, *args, **kwargs):
|
def many_init(cls, *args, **kwargs):
|
||||||
|
@ -928,13 +928,13 @@ class ModelSerializer(Serializer):
|
||||||
"""
|
"""
|
||||||
We have a bit of extra checking around this in order to provide
|
We have a bit of extra checking around this in order to provide
|
||||||
descriptive messages when something goes wrong, but this method is
|
descriptive messages when something goes wrong, but this method is
|
||||||
essentially just:
|
essentially just::
|
||||||
|
|
||||||
return ExampleModel.objects.create(**validated_data)
|
return ExampleModel.objects.create(**validated_data)
|
||||||
|
|
||||||
If there are many to many fields present on the instance then they
|
If there are many to many fields present on the instance then they
|
||||||
cannot be set until the model is instantiated, in which case the
|
cannot be set until the model is instantiated, in which case the
|
||||||
implementation is like so:
|
implementation is like so::
|
||||||
|
|
||||||
example_relationship = validated_data.pop('example_relationship')
|
example_relationship = validated_data.pop('example_relationship')
|
||||||
instance = ExampleModel.objects.create(**validated_data)
|
instance = ExampleModel.objects.create(**validated_data)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user