Skip to content
Browse files

Merged in charettes/south/dont-leave-defaults (pull request #101)

Make sure to get a prepared for save default value
  • Loading branch information...
2 parents 06f91f1 + 89482b0 commit 7c80445b5773d064175c609e11a7b4d75cf781ed @andrewgodwin andrewgodwin committed Jan 31, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 south/db/generic.py
View
4 south/db/generic.py
@@ -444,14 +444,14 @@ def _alter_set_defaults(self, field, name, params, sqls):
"Subcommand of alter_column that sets default values (overrideable)"
# Next, set any default
if not field.null and field.has_default():
- default = field.get_default()
+ default = field.get_db_prep_save(field.get_default(), connection=self._get_connection())
sqls.append(('ALTER COLUMN %s SET DEFAULT %%s ' % (self.quote_name(name),), [default]))
else:
sqls.append(('ALTER COLUMN %s DROP DEFAULT' % (self.quote_name(name),), []))
def _update_nulls_to_default(self, params, field):
"Subcommand of alter_column that updates nulls to default value (overrideable)"
- default = field.get_default()
+ default = field.get_db_prep_save(field.get_default(), connection=self._get_connection())
self.execute('UPDATE %(table_name)s SET %(column)s=%%s WHERE %(column)s IS NULL' % params, [default])
@invalidate_table_constraints

0 comments on commit 7c80445

Please sign in to comment.
Something went wrong with that request. Please try again.