-
Hi, i want to create users from forms register with specified default roles, how I can do it ? I have try like this but not works class User(SearchableMixin, db.Model, fsqla.FsUserMixin):
pass
first_name = db.Column(db.String(16), nullable=True)
last_name = db.Column(db.String(16), nullable=True)
def __init__(self, **kwargs):
"""add default role to user"""
super(User, self).__init__(**kwargs)
if self.roles == [] or self.roles is None:
self.roles = ["SuperUser"] Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Answered by
jwag956
Aug 27, 2021
Replies: 1 comment 2 replies
-
Attach to the user_registered signal, and add the role there:
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
dvrg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Attach to the user_registered signal, and add the role there: