class Loja(db.Model): id = db.Column(db.Integer, primary_key=True) titulo = db.Column(db.String(20)) funcs = db.relationship('Funcionario', backref='loja', lazy='dynamic') def __init__(self, t): self.titulo = t
class Funcionario(db.Model): id = db.Column(db.Integer, primary_key=True) id_loja = db.Column(db.Integer, db.ForeignKey('loja.id'))
class Disciplina(db.Model): id = db.Column(db.Integer, primary_key=True) alunos = db.relationship('Aluno', secondary=matriculas, backref=db.backref('disciplina', lazy='dynamic'))
class Telefone(db.Model): id = db.Column(db.Integer, primary_key=True)
class Pessoa(db.Model): id = db.Column(db.Integer, primary_key=True) id_telefone = db.Column(db.Integer, db.ForeignKey('telefone.id')) telefone = db.relationship('Telefone', backref='pessoa', uselist=False)
class Pessoa(db.Model): id = db.Column(db.Integer, primary_key=True) id_telefone = db.Column(db.Integer, db.ForeignKey('telefone.id')) telefone = db.relationship('Telefone', backref='pessoa', uselist=False) class Telefone(db.Model): id = db.Column(db.Integer, primary_key=True) matriculas = db.Table( 'matriculas', db.Column('aluno_id', db.Integer, db.ForeignKey('aluno.id')), db.Column('disciplina_id', db.Integer, db.ForeignKey('disciplina.id'))) class Aluno(db.Model): id = db.Column(db.Integer, primary_key=True) disciplinas = db.relationship('Disciplina', secondary=matriculas, backref=db.backref('aluno', lazy='dynamic')) class Disciplina(db.Model): id = db.Column(db.Integer, primary_key=True) alunos = db.relationship('Aluno', secondary=matriculas,