From 7bcd6978b09c9b132d1843ccf2ad0bb8ee23bc88 Mon Sep 17 00:00:00 2001 From: Scott Griffin Date: Tue, 28 Apr 2015 04:48:23 +0000 Subject: [PATCH 1/2] Added transaction commiting after the SQL update It appears that the transaction would need to be managed externally in order to actually update the DB. Now do it at the end of the bulk_update call. --- bulk_update/helper.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bulk_update/helper.py b/bulk_update/helper.py index 596a266..8f547f8 100644 --- a/bulk_update/helper.py +++ b/bulk_update/helper.py @@ -139,3 +139,4 @@ def bulk_update(objs, meta=None, update_fields=None, exclude_fields=None, del values, pks connection.cursor().execute(sql, parameters) + transaction.commit_unless_managed(using=using) From faaaa0411dcba1ce8be3c924d30c7f26cd2a93f9 Mon Sep 17 00:00:00 2001 From: Scott Griffin Date: Tue, 28 Apr 2015 04:51:03 +0000 Subject: [PATCH 2/2] Actually import transactions --- bulk_update/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bulk_update/helper.py b/bulk_update/helper.py index 8f547f8..4d383bd 100644 --- a/bulk_update/helper.py +++ b/bulk_update/helper.py @@ -5,7 +5,7 @@ import itertools -from django.db import connections, models +from django.db import connections, models, transaction from django.db.models.query import QuerySet