我刚刚将Bitnami Django VM从1.8.9更新到1.9.7。在升级之前一切都很顺利,但现在当我运行makemigrations时,我收到以下错误:
TypeError: Couldn't reconstruct field role on rapid.GeoViewRole: __init__() takes at least 2 arguments (1 given)
以下是相关课程/导入:
from django_enumfield import enum
class Role(enum.Enum):
VIEWER = 0
EDITOR = 1
OWNER = 2
labels = {
VIEWER: 'Viewer',
EDITOR: 'Editor',
OWNER: 'Owner'
}
class GeoViewRole(models.Model):
token = models.ForeignKey(ApiToken)
role = enum.EnumField(Role)
geo_view = models.ForeignKey(GeoView)
objects = models.GeoManager()
我无法弄清楚为什么升级后会出现此错误。
答案 0 :(得分:1)
对我来说这是django-enumfield的版本。我有
django-enumfield==1.2.1
我删除并安装
后迁移工作正常django_enumfield==1.3b2