mattupstate/flask-security — pull request #82 by maebert (2013-01-26 01:05:47+00:00)
Title: Flask-Peewee support

This pull request adds support for the [flask-peewee](https://github.com/coleifer/flask-peewee) ORM.

It should behave exactly as SQLAlchemy backed implementations, however due to the lack of direct many-to-many access, apps will have to provide a User-Role relationship explicitly:

```python
class Role(db.Model, RoleMixin):
...

class User(db.Model, UserMixin):
...

class UserRoles(Model):
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 requires UserRoles as an additional parameter
user_datastore = PeeweeUserDatastore(db, User, Role, UserRoles)
```

I wich I could hide that from the user though, but as most sub-modules access roles through the user model and not through `UserDatastore` I'm not quite sure how to do this elegantly. Ideas?

Fixes #59.