From f8e7ec5e5c6b0f787911bb934bba057d85800028 Mon Sep 17 00:00:00 2001 From: Jared Lewis Date: Tue, 18 Apr 2017 14:19:04 -0400 Subject: [PATCH] Use proper field prepare method --- docs/release_notes.rst | 4 ++++ querybuilder/query.py | 2 +- querybuilder/version.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/release_notes.rst b/docs/release_notes.rst index ba8c279..20145e1 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -1,6 +1,10 @@ Release Notes ============= +v0.14.2 +------- +* Fix upsert to use the proper prepare method on django fields + v0.14.1 ------- * Fix upsert to handle case when the uniqueness constraint is the pk field diff --git a/querybuilder/query.py b/querybuilder/query.py index 8303d2c..5663e27 100644 --- a/querybuilder/query.py +++ b/querybuilder/query.py @@ -1229,7 +1229,7 @@ def get_upsert_sql(self, rows, unique_fields, update_fields, auto_field_name=Non placeholders = [] for field in all_fields: # Convert field value to db value - sql_args.append(field.get_prep_value(getattr(row, field.column))) + sql_args.append(field.get_db_prep_save(getattr(row, field.column), self.connection)) placeholders.append('%s') row_values.append('({0})'.format(', '.join(placeholders))) row_values_sql = ', '.join(row_values) diff --git a/querybuilder/version.py b/querybuilder/version.py index 092052c..c41af0b 100644 --- a/querybuilder/version.py +++ b/querybuilder/version.py @@ -1 +1 @@ -__version__ = '0.14.1' +__version__ = '0.14.2'