Django Rest Framework - Getting a model instance after serialization
serializer.validated_data
should be used, not serializer.data
model_obj = serializer.save()
model_obj
holds the model instance and you can perform actions accordingly.
or you can write create()
or update()
method mentioned in official doc
Deserializing objects:
https://www.django-rest-framework.org/api-guide/serializers/#deserializing-objects