#24563: Migration for M2M Field fails with FieldDoesNotExist when removing
null=True from model
-------------------------------------+-------------------------------------
     Reporter:  GitRon               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  1.8
     Severity:  Normal               |               Resolution:
     Keywords:  migrations,          |             Triage Stage:
  many2many, nullable                |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by codefisher):

 * status:  closed => new
 * resolution:  needsinfo =>


Comment:

 I had exactly the same problem.   The following is a stack trace for the
 error.


 {{{
   File "manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "/usr/local/lib/python2.7/dist-
 packages/django/core/management/__init__.py", line 338, in
 execute_from_command_line
     utility.execute()
   File "/usr/local/lib/python2.7/dist-
 packages/django/core/management/__init__.py", line 330, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/usr/local/lib/python2.7/dist-
 packages/django/core/management/base.py", line 390, in run_from_argv
     self.execute(*args, **cmd_options)
   File "/usr/local/lib/python2.7/dist-
 packages/django/core/management/base.py", line 441, in execute
     output = self.handle(*args, **options)
   File "/usr/local/lib/python2.7/dist-
 packages/django/core/management/commands/migrate.py", line 221, in handle
     executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
   File "/usr/local/lib/python2.7/dist-
 packages/django/db/migrations/executor.py", line 110, in migrate
     self.apply_migration(states[migration], migration, fake=fake,
 fake_initial=fake_initial)
   File "/usr/local/lib/python2.7/dist-
 packages/django/db/migrations/executor.py", line 147, in apply_migration
     state = migration.apply(state, schema_editor)
   File "/usr/local/lib/python2.7/dist-
 packages/django/db/migrations/migration.py", line 115, in apply
     operation.database_forwards(self.app_label, schema_editor, old_state,
 project_state)
   File "/usr/local/lib/python2.7/dist-
 packages/django/db/migrations/operations/fields.py", line 201, in
 database_forwards
     schema_editor.alter_field(from_model, from_field, to_field)
   File "/usr/local/lib/python2.7/dist-
 packages/django/db/backends/base/schema.py", line 469, in alter_field
     return self._alter_many_to_many(model, old_field, new_field, strict)
   File "/usr/local/lib/python2.7/dist-
 packages/django/db/backends/sqlite3/schema.py", line 232, in
 _alter_many_to_many
     override_uniques=(new_field.m2m_field_name(),
 new_field.m2m_reverse_field_name()),
   File "/usr/local/lib/python2.7/dist-
 packages/django/db/backends/sqlite3/schema.py", line 137, in _remake_table
     self.create_model(temp_model)
   File "/usr/local/lib/python2.7/dist-
 packages/django/db/backends/base/schema.py", line 268, in create_model
     columns = [model._meta.get_field(field).column for field in fields]
   File "/usr/local/lib/python2.7/dist-
 packages/django/db/models/options.py", line 554, in get_field
     raise FieldDoesNotExist('%s has no field named %r' %
 (self.object_name, field_name))
 django.core.exceptions.FieldDoesNotExist: Forum_subscriptions has no field
 named None
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24563#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.1723718637d93b4cfbc425d35ab2fcf6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to