0

I have the following 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")

I have export FLASK_APP=run.py so when I run flask create_user (jsut a test user) from terminalI get the error saying:

Unexpected value for "rel_model" Expected "Model", "Proxy", "DeferredRelation", or "self"
Chang Zhao
  • 631
  • 2
  • 8
  • 24

1 Answers1

0

Try putting userMixin as the first class -- then db.Model as the second. Multi-inheritance is a bit weird with Python.

coleifer
  • 24,887
  • 6
  • 60
  • 75
  • well, that was how it was in the begining and what you are suggesting is what I thought so I tried `UserMixin` followed by `db.Model` – Chang Zhao Oct 23 '18 at 03:49