From afe0432a24c9fb04f4e144c09776d9444bfa4b40 Mon Sep 17 00:00:00 2001 From: Eric Delord Date: Mon, 9 Jan 2012 11:58:33 +0100 Subject: [PATCH] use of self.column instead of self.db_column --- bitfield/models.py | 2 +- bitfield/tests/tests.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bitfield/models.py b/bitfield/models.py index 3543da3..89ea079 100644 --- a/bitfield/models.py +++ b/bitfield/models.py @@ -117,7 +117,7 @@ def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False): if isinstance(value, SQLEvaluator) and isinstance(value.expression, Bit): value = value.expression if isinstance(value, (BitHandler, Bit)): - return BitQueryLookupWrapper(self.model._meta.db_table, self.db_column or self.name, value) + return BitQueryLookupWrapper(self.model._meta.db_table, self.column, value) return BigIntegerField.get_db_prep_lookup(self, lookup_type=lookup_type, value=value, connection=connection, prepared=prepared) diff --git a/bitfield/tests/tests.py b/bitfield/tests/tests.py index 0d847fd..d7465d6 100644 --- a/bitfield/tests/tests.py +++ b/bitfield/tests/tests.py @@ -140,8 +140,7 @@ def test_regression_1425(self): cursor = connection.cursor() flags_field = BitFieldTestModel._meta.get_field_by_name('flags')[0] - flags_db_column = flags_field.db_column or flags_field.name - cursor.execute("INSERT INTO %s (%s) VALUES (-1)" % (BitFieldTestModel._meta.db_table, flags_db_column)); + cursor.execute("INSERT INTO %s (%s) VALUES (-1)" % (BitFieldTestModel._meta.db_table, flags_field.column)) # There should only be the one row we inserted through the cursor. instance = BitFieldTestModel.objects.get(flags=-1) self.assertTrue(instance.flags.FLAG_0)