我无法修改或删除我的Parameter
模型,因为它以某种方式被schemamigration
命令使用。与其他型号配合使用一切正常。
当我删除Parameter.name
字段并运行schemamigration my_app --auto
命令时,我得到:
FieldError: Unknown field(s) (name) specified for Parameter
当我删除模型并运行schemamigration my_app --auto
命令时,我得到:
ImportError: cannot import name Parameter
我 models.py:
class Parameter(models.Model):
algorithm = models.ForeignKey(Algorithm, related_name='parameters',
null=True, blank=True,
verbose_name=_('Algorithm'))
name = models.CharField(_('Option'), max_length=255, null=True)
required = models.BooleanField(_('Required'), blank=True)
default = models.CharField(_('Default'), max_length=255,
null=True, blank=True)
label = models.CharField(_('Label'), max_length=255, null=True, blank=True)
description = models.TextField(_('Description'), null=True, blank=True)
description_lt = models.TextField(_('Description LT'), null=True, blank=True)
我怎么能找出问题所在?我该如何解决它?
从上面的错误来看,您似乎正在向管理实例注册模型和字段,或者表单实例 Django 会抱怨,如果您删除其中任何一个,搜索您的文件或第三方模块,如果您在其中任何一个中使用您的模型。