没有检测Django 1.7中扩展模型的变化 [英] makemigrations not detecting changes for Extended Models in Django 1.7
问题描述
我的settings.py:
My settings.py:
INSTALLED_APPS = (
'common',
'users',
)
和
common / models.py:
common/models.py:
class EduModel(models.Model):
class Meta:
abstract = True
app_label = 'ques_app_data'
users / models.py:
users/models.py:
class UserSubscription2(models.Model):
test = models.CharField(max_length=30, default='')
class UserSubscription3(EduModel):
test2 = models.CharField(max_length=30, default='')
$正在检测UserSubscription2的更改,但不是UserSubscription3(子类)的更改,b
$ b
makemigraions
任何人都可以解释一下吗?
makemigraions
is detecting changes for UserSubscription2, but not for UserSubscription3 (the child class). Can anyone please explain this ?
推荐答案
这是因为您的 app_label
ques_app_data
不包含在 INSTALLED_APPS
中。
That's because your app_label
ques_app_data
is not included in INSTALLED_APPS
.
INSTALLED_APPS = (
'common',
'users',
'ques_app_data',
)
我假设你有应用程序 ques_app_data
。 如果不是,那么这是一个问题,因为 app_label
必须引用现有的 Django应用程序
。
I am assuming you have the app ques_app_data
. If not then it's an issue, because app_label
must refer to an existing Django app
.
参考 https://docs.djangoproject.com/en/1.7/ref/models/options/#app-label
这篇关于没有检测Django 1.7中扩展模型的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!