<s> from flask . ext . security import UserMixin , RoleMixin <EOL> from util import generate_api_token <EOL> from . import db <EOL> class User ( db . Model , UserMixin ) : <EOL> __tablename__ = '<STR_LIT:user>' <EOL> id = db . Column ( db . Integer , primary_key = True ) <EOL> active = db . Column ( db . Boolean ) <EOL> email = db . Column ( db . String ( <NUM_LIT:255> ) , nullable = False , unique = True ) <EOL> password = db . Column ( db . String ( <NUM_LIT:255> ) , nullable = False ) <EOL> confirmed_at = db . Column ( db . DateTime ) <EOL> nickname = db . Column ( db . String ( <NUM_LIT:255> ) , nullable = False , unique = True ) <EOL> api_token = db . Column ( db . String ( <NUM_LIT> ) , default = lambda : generate_api_token ( ) , unique = True ) <EOL> roles = db . relationship ( '<STR_LIT>' , secondary = '<STR_LIT>' ) <EOL> admiral = db . relationship ( "<STR_LIT>" , uselist = False ) <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" . format ( self . email , self . nickname ) <EOL> class Role ( db . Model , RoleMixin ) : <EOL> __tablename__ = '<STR_LIT>' <EOL> id = db . Column ( db . Integer , primary_key = True ) <EOL> name = db . Column ( db . String ( <NUM_LIT> ) , nullable = False , unique = True ) <EOL> description = db . Column ( db . Text ) <EOL> users = db . relationship ( '<STR_LIT>' , secondary = '<STR_LIT>' ) <EOL> t_role__user = db . Table ( '<STR_LIT>' , db . Column ( '<STR_LIT>' , db . Integer , db . ForeignKey ( '<STR_LIT>' ) ) , <EOL> db . Column ( '<STR_LIT>' , db . Integer , db . ForeignKey ( '<STR_LIT>' ) ) ) </s>
