Django South迁移错误模块'对象没有属性' SET_NULL'

时间:2014-04-29 05:30:13

标签: python django django-models django-south

我刚刚通过./manage.py schemamigration --auto生成了迁移脚本并运行了它。我收到以下错误。我很难过这可能意味着什么。我一直在使用SET_NULL一段时间。所以这是一种新的事先没有发生的事情。知道什么可能是错的吗?

Traceback (most recent call last): File "./manage.py", line 16, in execute_from_command_line(sys.argv) File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/django/core/management/init.py", line 399, in execute_from_command_line utility.execute() File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv self.execute(*args, **options.dict) File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute output = self.handle(*args, **options) File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/south/management/commands/schemamigration.py", line 111, in handle old_orm = last_migration.orm(), File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/south/utils/init.py", line 62, in method value = function(self) File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/south/migration/base.py", line 432, in orm return FakeORM(self.migration_class(), self.app_label()) File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/south/orm.py", line 48, in FakeORM _orm_cache[args] = _FakeORM(*args)
File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/south/orm.py", line 134, in init self.retry_failed_fields() File "/home/vivekv/.environments/fantain/local/lib/python2.7/site-packages/south/orm.py", line 377, in retry_failed_fields fname, modelname, e ValueError: Cannot successfully create field 'winner' for model 'match': 'module' object has no attribute 'SET_NULL'.

2 个答案:

答案 0 :(得分:0)

好这不是一个有效的问题。我很尴尬地承认我对导致问题的迁移脚本进行了一些小调整。请忽略这个问题 - 好像我没有办法删除我问过的问题!

答案 1 :(得分:0)

我写了solution here

简答:使用models.SET_NULL代替"SET_NULL"。 您需要在具有b"SET_NULL"

的所有迁移中替换此项