|
@@ -1673,3 +1673,15 @@ class SchemaTests(TransactionTestCase):
|
|
|
)
|
|
|
if connection.features.can_introspect_default:
|
|
|
self.assertIsNone(field.default)
|
|
|
+
|
|
|
+ def test_add_textfield_unhashable_default(self):
|
|
|
+ # Create the table
|
|
|
+ with connection.schema_editor() as editor:
|
|
|
+ editor.create_model(Author)
|
|
|
+ # Create a row
|
|
|
+ Author.objects.create(name='Anonymous1')
|
|
|
+ # Create a field that has an unhashable default
|
|
|
+ new_field = TextField(default={})
|
|
|
+ new_field.set_attributes_from_name("info")
|
|
|
+ with connection.schema_editor() as editor:
|
|
|
+ editor.add_field(Author, new_field)
|