From 0980b8709bb0ced69604b92b697c2f566205ae67 Mon Sep 17 00:00:00 2001 From: Scott Griffin Date: Fri, 24 Apr 2015 21:14:38 +0000 Subject: [PATCH] Explicitly made connection passing a keyword arg. This is because (apprently) older versions of Django (1.3) attempt to do some sneaky meta programming and need a connection explicitly passed as a karg... otherwise it will attempt to pass one and an exception will be raised when the called methods get two connections! --- bulk_update/helper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bulk_update/helper.py b/bulk_update/helper.py index ae344e9..596a266 100644 --- a/bulk_update/helper.py +++ b/bulk_update/helper.py @@ -13,9 +13,9 @@ def _get_db_type(field, connection): if isinstance(field, (models.PositiveSmallIntegerField, models.PositiveIntegerField)): # integer CHECK ("points" >= 0)' - return field.db_type(connection).split(' ', 1)[0] + return field.db_type(connection=connection).split(' ', 1)[0] - res = field.db_type(connection) + res = field.db_type(connection=connection) return res @@ -106,7 +106,7 @@ def bulk_update(objs, meta=None, update_fields=None, exclude_fields=None, case_clause['params'].extend( [obj.pk, field.get_db_prep_value( - getattr(obj, field.attname), connection)]) + getattr(obj, field.attname), connection=connection)]) if pks: values = ', '.join(