mirror of
https://github.com/wassname/flask-security.git
synced 2026-07-27 11:22:12 +08:00
FIxes peewee description on quickstart
This commit is contained in:
+6
-1
@@ -195,11 +195,16 @@ possible using Peewee:
|
||||
confirmed_at = DateTimeField(null=True)
|
||||
|
||||
class UserRoles(Model):
|
||||
# Because peewee does not come with built-in many-to-many
|
||||
# relationships, we need this intermediary class to link
|
||||
# user to roles.
|
||||
user = ForeignKeyField(User, related_name='roles')
|
||||
role = ForeignKeyField(Role, related_name='users')
|
||||
name = property(lambda self: self.role.name)
|
||||
description = property(lambda self: self.role.description)
|
||||
|
||||
# Setup Flask-Security
|
||||
user_datastore = PeeweeUserDatastore(db, User, Role)
|
||||
user_datastore = PeeweeUserDatastore(db, User, Role, UserRoles)
|
||||
security = Security(app, user_datastore)
|
||||
|
||||
# Create a user to test with
|
||||
|
||||
Reference in New Issue
Block a user