Ejemplo n.º 1
0
class User(db.Model, UserMixin):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True)

    # User authentication information (required for Flask-User)
    email = db.Column(db.Unicode(255),
                      nullable=False,
                      server_default=u'',
                      unique=True)
    confirmed_at = db.Column(db.DateTime())
    password = db.Column(db.String(255), nullable=False, server_default='')
    # reset_password_token = db.Column(db.String(100), nullable=False, server_default='')
    active = db.Column(db.Boolean(), nullable=False, server_default='0')

    # User information
    active = db.Column('is_active',
                       db.Boolean(),
                       nullable=False,
                       server_default='0')
    first_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')
    last_name = db.Column(db.Unicode(50), nullable=False, server_default=u'')

    # Relationships
    roles = db.relationship('Role',
                            secondary='users_roles',
                            backref=db.backref('users', lazy='dynamic'))
Ejemplo n.º 2
0
class Role(db.Model):
    __tablename__ = 'roles'
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(50),
                     nullable=False,
                     server_default=u'',
                     unique=True)  # for @roles_accepted()
    label = db.Column(db.Unicode(255),
                      server_default=u'')  # for display purposes