Ticket #25074: 4486.patch

File 4486.patch, 1.1 KB (added by Eugene Pankov, 9 years ago)

patch

  • django/db/backends/mysql/schema.py

    From 09283870d007189f811105b7ea3c387ec84ffe3f Mon Sep 17 00:00:00 2001
    From: Ron Konigsberg <ronkonigsberg@gmail.com>
    Date: Mon, 13 Apr 2015 15:01:30 +0300
    Subject: [PATCH] bugfix: support defaults which are unhashable (e.g. JsonField
     default={})
    
    ---
     django/db/backends/mysql/schema.py | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/django/db/backends/mysql/schema.py b/django/db/backends/mysql/schema.py
    index 7f3a2d3..6933380 100644
    a b def add_field(self, model, field):  
    4343        super(DatabaseSchemaEditor, self).add_field(model, field)
    4444
    4545        # Simulate the effect of a one-off default.
    46         if self.skip_default(field) and field.default not in {None, NOT_PROVIDED}:
     46        if self.skip_default(field) and field.default not in [None, NOT_PROVIDED]:
    4747            effective_default = self.effective_default(field)
    4848            self.execute('UPDATE %(table)s SET %(column)s = %%s' % {
    4949                'table': self.quote_name(model._meta.db_table),
Back to Top