#23614: Altering unique_together sometimes missing deleted fields ----------------------------+------------------------------------ Reporter: Naddiseo | Owner: nobody Type: Bug | Status: new Component: Migrations | Version: 1.7 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------+------------------------------------ Changes (by bmispelon):
* stage: Unreviewed => Accepted Comment: Hi, I can reproduce the issue (I had to use `c = models.ForeignKey('ham.Ham', null=True)` though otherwise it asked me for a default when running `makemigrations`). The traceback under Python 3 provides a little bit more information: {{{#!python Traceback (most recent call last): File "./django/db/models/options.py", line 404, in get_field_by_name return self._name_map[name] AttributeError: 'Options' object has no attribute '_name_map' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "./django/db/models/options.py", line 407, in get_field_by_name return cache[name] KeyError: 'a' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "./django/core/management/__init__.py", line 336, in execute_from_command_line utility.execute() File "./django/core/management/__init__.py", line 328, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "./django/core/management/base.py", line 369, in run_from_argv self.execute(*args, **cmd_options) File "./django/core/management/base.py", line 419, in execute output = self.handle(*args, **options) File "./django/core/management/commands/migrate.py", line 193, in handle executor.migrate(targets, plan, fake=options.get("fake", False)) File "./django/db/migrations/executor.py", line 63, in migrate self.apply_migration(migration, fake=fake) File "./django/db/migrations/executor.py", line 97, in apply_migration migration.apply(project_state, schema_editor) File "./django/db/migrations/migration.py", line 107, in apply operation.database_forwards(self.app_label, schema_editor, project_state, new_state) File "./django/db/migrations/operations/fields.py", line 84, in database_forwards schema_editor.remove_field(from_model, from_model._meta.get_field_by_name(self.name)[0]) File "./django/db/backends/sqlite3/schema.py", line 185, in remove_field self._remake_table(model, delete_fields=[field]) File "./django/db/backends/sqlite3/schema.py", line 128, in _remake_table self.create_model(temp_model) File "./django/db/backends/schema.py", line 253, in create_model columns = [model._meta.get_field_by_name(field)[0].column for field in fields] File "./django/db/backends/schema.py", line 253, in <listcomp> columns = [model._meta.get_field_by_name(field)[0].column for field in fields] File "./django/db/models/options.py", line 410, in get_field_by_name % (self.object_name, name)) django.db.models.fields.FieldDoesNotExist: Spam has no field named 'a' }}} Thanks! -- Ticket URL: <https://code.djangoproject.com/ticket/23614#comment:2> 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/066.c3d1246e285c732d555d93077a241643%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.