我有以下型号:
class MemberCategory(BaseModel):
"""
Contains Predfined Category Types
"""
title = models.CharField(null=True, blank=True, max_length=100)
description = models.TextField(null=True, blank=True)
slug = models.SlugField(null=True, blank=True)
基本模型如下所示:
class BaseModel(models.Model):
"""
An abstract base class model that provides self-managed "created" and
"modified" multi tenant fields.
"""
creation_date = models.DateTimeField(auto_now_add=True)
modification_date = models.DateTimeField(auto_now=True)
class Meta:
abstract = True
现在我在我的MemberCategory中添加一个字段org
,以便新模型如下所示:
class MemberCategory(BaseModel):
"""
Contains Predfined Category Types
"""
title = models.CharField(null=True, blank=True, max_length=100)
description = models.TextField(null=True, blank=True)
slug = models.SlugField(null=True, blank=True)
orgs = models.ForeignKey(Org, null=True, blank=True)
在此之后我做了 - python manage.py schemamigration <app_name> --auto
没有错误,一切都很好。
然后我执行python manage.py migrate <app_name>
会抛出以下错误 -
KeyError: u'creation_date'
我收到此错误的原因是什么?