【发布时间】:2015-07-21 20:24:28
【问题描述】:
有一个像下面这样的模型
from django.contrib.auth.models import User # has migrations in 1.7
class MyProxyUser(User):
class Meta:
proxy = True
在没有迁移的应用中运行测试时会出现以下错误:
django.db.migrations.state.InvalidBasesError: Cannot resolve bases for [<ModelState: 'django_proxy_model_problems.MyProxyUser'>]
This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)
in an app with no migrations; see https://docs.djangoproject.com/en/1.7/topics/migrations/#dependencies for more
都读过
- https://docs.djangoproject.com/en/1.8/topics/migrations/#dependencies
- https://docs.djangoproject.com/en/1.8/topics/db/models/#proxy-models
我不知道应该怎么做才能解决这个问题(manage.py makemigrations 报告No changes detected)
可以通过使用this github repo 运行tox -e py27-django17 来重现该问题
这可以在 Django 1.7 和 1.8 中重现,但在 1.4 中可以正常工作
【问题讨论】:
标签: django django-models django-migrations