kelvinwong-ca / django-select-multiple-field

Select multiple choices in a single Django model field
Other
34 stars 25 forks source link

Does not work with migrations #4

Open nomeata opened 9 years ago

nomeata commented 9 years ago

I’m trying to add a field with a default (all choices set) to my models, but Django 1.7 won’t let me apply the migration:

Operations to perform:
  Apply all migrations: teilnehmer
Running migrations:
  Applying teilnehmer.0008_auto_20141205_2057...Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 160, in handle
    executor.migrate(targets, plan, fake=options.get("fake", False))
  File "/usr/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 63, in migrate
    self.apply_migration(migration, fake=fake)
  File "/usr/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 97, in apply_migration
    migration.apply(project_state, schema_editor)
  File "/usr/lib/python2.7/dist-packages/django/db/migrations/migration.py", line 107, in apply
    operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
  File "/usr/lib/python2.7/dist-packages/django/db/migrations/operations/fields.py", line 37, in database_forwards
    field,
  File "/usr/lib/python2.7/dist-packages/django/db/backends/sqlite3/schema.py", line 167, in add_field
    self._remake_table(model, create_fields=[field])
  File "/usr/lib/python2.7/dist-packages/django/db/backends/sqlite3/schema.py", line 128, in _remake_table
    self.create_model(temp_model)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/schema.py", line 263, in create_model
    self.execute(sql, params)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/schema.py", line 99, in execute
    cursor.execute(sql, params)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/utils.py", line 81, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/dist-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 485, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: near "None": syntax error

It does not matter whether I give the choices as a list or a comma-separated string.

kelvinwong-ca commented 9 years ago

Support for Django 1.7 migrations is coming in version 0.4.0

kelvinwong-ca commented 9 years ago

Version 0.4.0 has been released. The Django 1.7 migrations support has been added but it was not significantly tested. 0.4.1 will have more tests but I might not get that release out for some time.