Problem
By default, Django immediately commits changes to the database. When exceptions occur during a series of commits, this can leave your database in an unwanted state:
def create_category(name, products):
category = Category.objects.create(name=name)
product_api.add_products_to_cate...