0

This is my first time using Flask-Security, and I can't seem to successfully create a user.

Every time I try, I get a "User object has no attribute roles" error.

Here is the relevant code: https://gist.github.com/ianseyer/f08d3f47471588e79022

EDIT: Realized it might be because i didn't not have __tablename__ = 'roles', but that gives me this error:

sqlalchemy.exc.ArgumentError: Could not determine join condition between parent/child     tables on relationship User.role.  Specify a 'primaryjoin' expression.  If 'secondary' is     present, 'secondaryjoin' is needed as well.
4

1 回答 1

1

你已经调用它了role。改变

role = db.relationship('Role', secondary=roles_users, backref=db.backref('users', lazy='dynamic'))

roles = db.relationship('Role', secondary=roles_users, backref=db.backref('users', lazy='dynamic'))
于 2014-05-09T12:48:34.197 回答