object save needs to be atomic transaction so entire object is saved
@@ -4,7 +4,7 @@ from collections import OrderedDict
from functools import reduce, wraps
from itertools import chain
-from django.db import models
+from django.db import models, transaction
from django.db.models import Field, FieldDoesNotExist, Manager, ManyToManyRel, Prefetch, Q
from django.utils.functional import cached_property
@@ -276,6 +276,7 @@ class ModelInstanceWrapper(BaseWrapper):
author = self._author
if self.pk is None:
self._changeset.add_create(self, author=author)
+ with transaction.atomic():
for field, initial_value in self._initial_values.items():
if field.many_to_one:
try:
