获取错误“rel_model”的意外值预期 "Model"、"Proxy"、"DeferredRelation" 或 "self"

getting error Unexpected value for ''rel_model" Expected "Model", "Proxy", "DeferredRelation", or "self"

我有以下class

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"

尝试将 userMixin 作为第一个 class -- 然后 db.Model 作为第二个。 Python.

的多重继承有点奇怪