class Quotes(db.Model): id = db.Column(db.Integer, primary_key=True) quoteauthor = db.Column(db.String(100), index=True) quotestring = db.Column(db.String(200), index=True) def __repr__(self): return "<Quote : {}>".format(self.quotestring)
class Post(db.Model): id = db.Column(db.Integer, primary_key=True) body = db.Column(db.String(140)) timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) def __repr__(self): return '<Post {}>'.format(self.body)
class Task(db.Model): id = db.Column(db.Integer, primary_key=True) task = db.Column(db.String(500), index=True, nullable=False, primary_key=True) status = db.Column(db.String(10), index=True) updated = db.Column(db.DateTime)
class User(db.Model): id = db.Column(db.Integer, primary_key=True) fname = db.Column(db.String(100), index=True) lname = db.Column(db.String(100), index=True) email = db.Column(db.String(120), index=True, unique=True) def __repr__(self): return "<User : {}>".format(self.fname + ' ' + self.lname)
class StatusHistory(db.Model): id = db.Column(db.Integer, primary_key=True) task_id = db.Column(db.Integer) updated = db.Column(db.DateTime) user_id = db.Column(db.String(20), index=True) task = db.Column(db.String(500), index=True) target = db.Column(db.String(100), index=True) onTrack = db.Column(db.Boolean, index=True) cupdate = db.Column(db.String(500), index=True) issues = db.Column(db.String(500), index=True)
class Status(db.Model): id = db.Column(db.Integer, primary_key=True) task_id = db.Column(db.Integer, index=True) task = db.Column(db.String(500), index=True) target = db.Column(db.String(100), index=True) onTrack = db.Column(db.Boolean, index=True) cupdate = db.Column(db.String(500), index=True) issues = db.Column(db.String(500), index=True)
class User(db.Model): name = db.Column(db.String(20), primary_key=True, index=True) type = db.Column(db.String(20), index=True) pwd = db.Column(db.String(20), index=True) authenticated = db.Column(db.Boolean(), default=False) def is_active(self): """True, as all users are active.""" return True def get_id(self): """Return the email address to satisfy Flask-Login's requirements.""" return self.name def is_authenticated(self): """Return True if the user is authenticated.""" return self.authenticated def is_anonymous(self): """False, as anonymous users aren't supported.""" return False
class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(64), index=True, unique=True) email = db.Column(db.String(120), index=True, unique=True) about_me = db.Column(db.String(140)) last_seen = db.Column(db.DateTime, default=datetime.utcnow) password_hash = db.Column(db.String(128)) posts = db.relationship( 'Post', backref='author', lazy='dynamic') # a high level view of the relationship def set_password(self, password): self.password_hash = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password_hash, password) def avatar(self, size): digest = md5(self.email.lower().encode('utf-8')).hexdigest() return 'https://www.gravatar.com/avatar/{}?d=identicon&s={}'.format( digest, size) def __repr__(self): return '<User {}>'.format(self.username)
class UniqueIDs(db.Model): id = db.Column(db.Integer, primary_key=True) status_id = db.Column(db.Integer) task_id = db.Column(db.Integer) user_id = db.Column(db.Integer) status_hist_id = db.Column(db.Integer)