我从 Django 1.6 升级到 1.7。安装了与 Django 1.7 兼容的 Python 2.7。当我运行代码 python manage.py makemigrations
时,我收到以下错误消息:
Traceback (most recent call last):
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 385, in execute_from_command_line
utility.execute()
File "/usr/local/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/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/m akemigrations.py", line 111, in handle
convert_apps=app_labels or None,
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/autodetector.py", line 42, in changes
changes = self._detect_changes(convert_apps, graph)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/autodetector.py", line 109, in _detect_changes
self.old_apps = self.from_state.render(ignore_swappable=True)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/state.py", line 67, in render
model.render(self.apps)
File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/state.py", line 312, in render
body,
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 284, in __new__
new_class._prepare()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 344, in _prepare
signals.class_prepared.send(sender=cls)
File "/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 198, in send
response = receiver(signal=self, sender=sender, **named)
File "/usr/local/lib/python2.7/dist-packages/model_utils/fields.py", line 57, in prepare_class
% sender.__name__
AssertionError: To use StatusField, the model 'ShellRequest' must have a STATUS choices class attribute.
阅读博文here ,我不知道从哪里开始。如果有人能给我指导如何处理这个问题,我将不胜感激。
最佳答案
关于python - 升级到 Django 1.7。 AssertionError : To use StatusField, 模型 'ShellRequest' 必须具有 STATUS 选择类属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43985015/