我有这个模型
class Category(models.Model):
category_name= models.CharField(max_length=255)
sub_category_ID = models.IntegerField(null=True, blank=True)
def __unicode__(self):
return self.category_name
我已经在表中有数据,但我想在sub_category_ID
不删除整个数据库的情况下将其更改为。
class Category(models.Model):
category_name= models.CharField(max_length=255)
sub_category_ID = models.ForeignKey('self',null=True, blank=True)
def __unicode__(self):
return self.category_name
所以我在更改模型后运行了syncdb,它给了我警告。
The following content types are stale and need to be deleted:
uTriga | event_event_category
Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.`
我输入了是,现在出现错误
column app_category.sub_category_ID_id does not exist
列 uTriga_category.sub_category_ID_id 不存在