我有以下课程
class User(db.Model, UserMixin):
user = peewee.CharField(max_length=255)
email = peewee.CharField(max_length=256)
class UserRoles(db.Model):
user = peewee.ForeignKeyField(User, related_name="roles")
我有export FLASK_APP=run.py
所以当我从终端运行flask create_user(测试用户)时,我得到了错误提示:
Unexpected value for "rel_model" Expected "Model", "Proxy", "DeferredRelation", or "self"
答案 0 :(得分:0)
尝试将userMixin作为第一类,然后将db.Model作为第二类。多继承在Python中有点奇怪。