Commit faa8c71f authored by Claude Paroz's avatar Claude Paroz
Browse files

Moved misplaced transaction.atomic from 0dce44e1

Thanks Florian Apolloner for noticing the issue and Aymeric
Augustin for the expertise.
Refs #22540.
parent 3818d964
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -364,7 +364,6 @@ class QuerySet(object):
        """
        obj = self.model(**kwargs)
        self._for_write = True
        with transaction.atomic(using=self.db):
        obj.save(force_insert=True, using=self.db)
        return obj

@@ -448,6 +447,7 @@ class QuerySet(object):
        Used by get_or_create and update_or_create
        """
        try:
            with transaction.atomic(using=self.db):
                obj = self.create(**params)
            return obj, True
        except IntegrityError: