class UserModel(UserMixin, flask_login.UserMixin, db.Model): __tablename__ = 'users' posts = db.relationship('PostModel', backref='user') comments = db.relationship('CommentModel', backref='user') test_model = TestUserModel
class TestTheaterModel(TheaterMixin, db.Model): __tablename__ = 'test_theaters' cinema_id = db.Column(db.Integer(), db.ForeignKey('test_cinemas.id')) theater_tickets = db.relationship('TestTheaterTicketModel', backref='theater')
class MovieModel(MovieMixin, db.Model): __tablename__ = 'movies' __table_args__ = {'extend_existing': True} test_model = TestMovieModel showtimes = db.relationship('ShowtimeModel')
class TheaterModel(TheaterMixin, db.Model): __tablename__ = 'theaters' __table_args__ = {'extend_existing': True} test_model = TestTheaterModel theater_tickets = db.relationship('TheaterTicketModel')
class TestShowtimeModel(ShowtimeMixin, db.Model): __tablename__ = 'test_showtimes' cinema_id = db.Column(db.Integer, db.ForeignKey('test_cinemas.id')) movie_id = db.Column(db.Integer, db.ForeignKey('test_movies.id')) theater_id = db.Column(db.Integer, db.ForeignKey('test_theaters.id')) theater = db.relationship('TestTheaterModel', backref='showtimes')
class MovieModel(MovieMixin, db.Model): __tablename__ = 'movies' test_model = TestMovieModel showtimes = db.relationship('ShowtimeModel', backref='movie', order_by='ShowtimeModel.start_time')
class TestShowtimeModel(ShowtimeMixin, db.Model): __tablename__ = 'test_showtimes' __table_args__ = {'extend_existing': True} movie_id = db.Column(db.Integer, db.ForeignKey('test_movies.id')) theater_id = db.Column(db.Integer, db.ForeignKey('test_theaters.id')) theater = db.relationship('TestTheaterModel')
class PostModel(PostMixin, db.Model): __tablename__ = 'posts' user_id = db.Column(db.Integer(), db.ForeignKey('users.id')) tags = db.relationship('TagModel', backref='post') test_model = TestPostModel