class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(255), unique=True) name = db.Column(db.String(255), nullable=False) phone_number = db.Column(db.String(255)) photo = db.Column(db.String(255)) about = db.Column(db.String(1000)) why = db.Column(db.String(1000)) password = db.Column(db.String(255)) active = db.Column(db.Boolean(), default=False) approved = db.Column(db.Boolean(), default=False) confirmed_at = db.Column(db.DateTime()) roles = db.relationship('Role', secondary=roles_users, backref=db.backref('users', lazy='dynamic')) registered_at = db.Column(db.DateTime, default=datetime.now) @property def is_logged_in(self): return False if self.is_anonymous() else True @property def is_admin(self): return self.roles and self.roles[0].name == 'admin' def __repr__(self): return self.name @property def admin_url(self): return "%s/%s/%s" % (app.config['ADMIN_URL'], 'user', self.id) @property def url(self): return "%s/%s/" % ('profiles', self.name)
class DeviceDemo(db.Model): id = db.Column( db.Integer, autoincrement=True) # primary keys are required by SQLAlchemy # email = db.Column(db.String(100), unique=True) status = db.Column(db.Boolean(), default=False) name = db.Column(db.String(1000), primary_key=True) is_active = db.Column(db.Boolean(), default=False) command = db.Column(db.Integer, default=-1)
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) user_profile_id = db.Column( db.Integer(), db.ForeignKey('user_profile.id', ondelete='CASCADE')) # User authentication information username = db.Column(db.String(50), nullable=False, unique=True) password = db.Column(db.String(255), nullable=False, server_default='') reset_password_token = db.Column(db.String(100), nullable=False, server_default='') is_active = db.Column('is_active', db.Boolean(), nullable=False, server_default='0') # User email information email = db.Column(db.String(255), nullable=False, unique=True) confirmed_at = db.Column(db.DateTime()) # Relationships user_profile = db.relationship('UserProfile', uselist=False, foreign_keys=[user_profile_id]) def __repr__(self): return '<id: {}, user_profile_id: {}, username: {}, is_active: {}, email: {}' \ .format(self.id, self.user_profile_id, self.username, self.is_active, self.email)
class User(db.Model): id = db.Column( db.Integer, autoincrement=True) # primary keys are required by SQLAlchemy # email = db.Column(db.String(100), unique=True) pwd = db.Column(db.String(100)) name = db.Column(db.String(1000), primary_key=True) is_active = db.Column(db.Boolean(), default=False) def __repr__(self): return '<User %r>' % (self.name)
class User(db.Model): __tablename__ = "users" id = db.Column(db.Integer, primary_key=True, autoincrement=True) username = db.Column(db.String(128), nullable=False) email = db.Column(db.String(128), nullable=False) active = db.Column(db.Boolean(), default=False, nullable=False) created_at = db.Column(db.DateTime, nullable=False) def __init__(self, username, email): self.username = username self.email = email self.created_at = datetime.datetime.utcnow()
class User(db.Model, UserMixin): id = db.Column(db.Integer,primary_key=True) first_name = db.Column(db.String(200),index = True) last_name = db.Column(db.String(200),index = True) username = db.Column(db.String(200), index = True) email = db.Column(db.String(200), index = True) password = db.Column(db.String(200),index = True) year = db.Column(db.Date) active = db.Column(db.Boolean()) roles = db.relationship('Role',secondary = roles_user, backref = 'users') book = db.relationship('Book', secondary = book_user, lazy = 'select') def leave_book(self,book): self.book.remove(book)
class User(UserMixin, db.Model): __bind_key__ = 'users' id = db.Column(db.Integer, primary_key=True) date_created = db.Column(db.DateTime, default=db.func.current_timestamp()) date_modified = db.Column(db.DateTime, default=db.func.current_timestamp(), onupdate=db.func.current_timestamp()) email = db.Column(db.String(255)) username = db.Column(db.String(80), unique=True) password = db.Column(db.String(100)) fname = db.Column(db.String(50)) lname = db.Column(db.String(50)) interests = db.Column(db.String(500)) education = db.Column(db.String(100)) user_since = db.Column(db.DateTime(), default=db.func.current_timestamp()) verified = db.Column(db.Boolean(), default=False) def set_password(self, password): self.password = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password, password) def is_verified(self): return self.verified def get_name(self): return self.username def get_email(self): return self.email def get_education(self): return self.education def get_date_created(self): return self.date_created def get_date_modified(self): return self.date_modified def get_interests(self): return self.interests def get_interests_list(self): return self.interests.split(",")
class User(db.Model, UserMixin): id = db.Column(db.Integer(), primary_key=True) email = db.Column(db.String(255), unique=True) password = db.Column(db.String(255)) scores = db.Column(db.Integer(), default=0) active = db.Column(db.Boolean(), default=True) roles = db.relationship('Role', secondary=role_user_link, backref=db.backref('users', lazy='dynamic')) palindromes = db.relationship('Palindrome', secondary=palindrome_user_link, backref=db.backref('users', lazy='dynamic')) def __repr__(self): return 'ID: {}, Email: {}'.format(self.id, self.email)