1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #21783: More SQLite default fun with nulls.

This commit is contained in:
Andrew Godwin
2014-01-25 00:09:56 +00:00
parent 06bd181f97
commit 2a30b39f40
3 changed files with 31 additions and 5 deletions

View File

@@ -223,12 +223,12 @@ class DatabaseOperations(BaseDatabaseOperations):
except _sqlite3.ProgrammingError:
pass
# Manual emulation of SQLite parameter quoting
if isinstance(value, six.integer_types):
if isinstance(value, type(True)):
return str(int(value))
elif isinstance(value, six.integer_types):
return str(value)
elif isinstance(value, six.string_types):
return '"%s"' % six.text_type(value)
elif isinstance(value, type(True)):
return str(int(value))
elif value is None:
return "NULL"
else:

View File

@@ -30,7 +30,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
for field in create_fields:
body[field.name] = field
# If there's a default, insert it into the copy map
if field.get_default():
if field.has_default():
mapping[field.column] = self.connection.ops.quote_parameter(
field.get_default()
)