0

我有以下课程

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(jsut一个测试用户)时,我得到了错误消息:

Unexpected value for "rel_model" Expected "Model", "Proxy", "DeferredRelation", or "self"
4

1 回答 1

0

尝试将 userMixin 作为第一类——然后将 db.Model 作为第二类。Python 的多重继承有点奇怪。

于 2018-10-22T19:20:41.800 回答