Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use of self.column instead of self.db_column #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bitfield/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions bitfield/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down