Answer the question
In order to leave comments, you need to log in
How to understand which method will be called in Django?
Hello, in the documentation
www.django-rest-framework.org/tutorial/1-serialization the page says
"The first part of the serializer class defines the fields that get serialized/deserialized. The create() and update() methods define how fully fledged instances are created or modified when calling serializer.save() "
as I understand it, this means that when serializer.save() is called, either create() or update() is called.
But I can't figure out where and which method is defined will eventually be called create() or update() when calling serializer.save()
Answer the question
In order to leave comments, you need to log in
And this is not to be understood. At least, I cannot imagine such a case when it is really needed.
There are also methods for a view perform_create()
or perform_update()
a viewset. There is create()
also update()
a serializer. Let them implement the final logic of saving or creating an object.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question