class Users(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) email = db.Column(db.String(250), unique=True, nullable=False) name = db.Column(db.String(250), nullable=False) password = db.Column(db.String(), nullable=False) is_enabled = db.Column(db.Boolean(), nullable=False, server_default='False') def __init__(self, email, name, password, is_enabled=False): self.email = email self.name = name self.password = generate_password_hash(password) self.is_enabled = is_enabled def add(self, user): db.session.add(user) return session_commit() def update(self): return session_commit() def delete(self, user): db.session.delete(user) return session_commit() def is_active(self): return self.is_enabled
class Media_File(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) title = db.Column(db.String(250)) slug = db.Column(db.String(250)) path = db.Column(db.String(250)) image_path = db.Column(db.String(250)) overview = db.Column(db.TEXT()) media_type = db.Column(db.String(250)) __mapper_args__ = {'polymorphic_on': media_type}
class Series(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) tmdb_id = db.Column(db.Integer) title = db.Column(db.String(250)) overview = db.Column(db.String(250), nullable=True) series_art = db.Column(db.String(250), nullable=True) slug = db.Column(db.String(250)) def __init__(self, tmdb_id, title, overview, series_art): self.tmdb_id = tmdb_id self.title = title self.overview = overview self.series_art = series_art self.slug = self.create_slug(self.title) def create_slug(self, title): return slugify(title)
class Season(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) number = db.Column(db.Integer) overview = db.Column(db.TEXT()) art = db.Column(db.String()) series = db.Column(db.Integer, db.ForeignKey(Series.id)) def __init__(self, number, overview, art, series): self.number = number self.overview = overview self.art = art self.series = series
class Tags(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) tag = db.Column(db.String(250))