我正在尝试迁移我的一个模型以删除此更改,但我正在获取下面的追溯。
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 346, 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 394, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 445, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 222, 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 112, in migrate
self.unapply_migration(states[migration], migration, fake=fake)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 168, in unapply_migration
state = migration.unapply(state, schema_editor)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/migration.py", line 162, in unapply
operation.database_backwards(self.app_label, schema_editor, from_state, to_state)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/operations/fields.py", line 206, in database_backwards
self.database_forwards(app_label, schema_editor, from_state, to_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 473, in alter_field
not new_field.rel.through._meta.auto_created):
AttributeError: 'unicode' object has no attribute '_meta'
这是迁移
class Migration(migrations.Migration):
dependencies = [
('app', '0004_auto_20151130_2345'),
]
operations = [
migrations.RenameModel('OldModelName', 'NewModelName'),
migrations.AlterField(
model_name='adifferentmodel',
name='them2mfieldname',
field=models.ManyToManyField(to='app.TheSecondModel', through='app.NewModelName', blank=True),
),
]