Do I need to explicitly use transactions with Django Rest Framework serializer updates?

前端 未结 3 2160
夕颜
夕颜 2020-12-10 17:24

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

3条回答
  •  执笔经年
    2020-12-10 17:39

    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.

提交回复
热议问题