According to http://www.django-rest-framework.org/api-guide/serializers/#writable-nested-representations, in order to accept a nested serializer I need to create an up
up
first import transaction module from db, and then use the following
with transtaction.atomic(): pass
This will ensure the atomicity and consistency of your data into database.