InvalidBasesError:无法解析[< ModelState:'users.GroupProxy'>]的基础 [英] InvalidBasesError: Cannot resolve bases for [<ModelState: 'users.GroupProxy'>]
本文介绍了InvalidBasesError:无法解析[< ModelState:'users.GroupProxy'>]的基础的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行测试时,我在数据库初始化期间得到这个错误:
When I run tests I get this error during database initialization:
django.db.migrations.state.InvalidBasesError: Cannot resolve bases for [<ModelState: 'users.GroupProxy'>]
This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)
我创建了这个代理,用于contrib.auth组模型,将其放在我的应用程序中,在django admin中:
I created this proxy for contrib.auth Group model to place it in my app in django admin:
class GroupProxy(Group):
class Meta:
proxy = True
verbose_name = Group._meta.verbose_name
verbose_name_plural = Group._meta.verbose_name_plural
那么我可以做些什么来解决这个问题?
So what can I do to fix this issue?
推荐答案
经过很多挖掘,对我来说唯一有用的是
After a lot of digging on this the only thing that worked for me was
注释掉有罪的应用程序,运行迁移,然后重新添加。
只是一个解决方法,但希望它h elps somebody。
Just a workaround but hopefully it helps somebody.
这篇关于InvalidBasesError:无法解析[< ModelState:'users.GroupProxy'>]的基础的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文