Exemple #1
0
class User(db.Model):
    __tablename__ = 't_user'
    id = db.Column(db.Integer, primary_key=True)
    uname = db.Column(db.String(30))
    passwd = db.Column(db.String(255))
    authors = db.relationship('Author',
                              secondary=user_author,
                              backref=db.backref('users'))
Exemple #2
0
class Book(db.Model):
    __tablename__ = 't_book'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20))
    writer = db.Column(db.String(10))
    sort_id = db.Column(db.String(5), db.ForeignKey('t_sort.id'))
    price = db.Column(db.Integer)
    pub_company = db.Column(db.String(20))
    pub_date = db.Column(db.DATE)
    total_num = db.Column(db.INT)
    current_num = db.Column(db.Integer)
    buy_date = db.Column(db.DATE)
    brief = db.Column(db.String(100))

    sort = db.relationship('Sort', backref=db.backref('books', lazy=True))
    book_student = db.relationship('Book_Student', back_populates='book')
Exemple #3
0
class Author(db.Model):
    __tablename__ = 't_author'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(32))
    roles = db.relationship('Role',
                            secondary=role_author,
                            backref=db.backref('authors'))
Exemple #4
0
class Student(db.Model):
    __tablename__ = 't_student'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(10))
    real_name = db.Column(db.String(10))
    passwd = db.Column(db.String(50))
    college_id = db.Column(db.Integer, db.ForeignKey('t_college.id'))
    class_id = db.Column(db.Integer, db.ForeignKey('t_class.id'))
    sex = db.Column(db.String(2))
    telephone = db.Column(db.String(15))
    email = db.Column(db.String(20))
    lended_num = db.Column(db.Integer)
    create_date = db.Column(db.DATE)
    state = db.Column(db.Integer, db.ForeignKey('t_student_state.id'))

    college = db.relationship("College",
                              backref=db.backref('students', lazy=True))
    class_ = db.relationship("Class_",
                             backref=db.backref('students', lazy=True))

    book_student = db.relationship('Book_Student',
                                   backref=db.backref('students', lazy=True))
    student_state = db.relationship('Student_State')
Exemple #5
0
class Role(db.Model):
    __tablename__ = 't_role'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20))
    url = db.Column(db.String(255))
Exemple #6
0
class Sort(db.Model):
    __tablename__ = 't_sort'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20))
    book = db.relationship('Book', back_populates='sort')
Exemple #7
0
class Class_(db.Model):
    __tablename__ = 't_class'
    id = db.Column(db.INT, primary_key=True)
    name = db.Column(db.String(30))
    student = db.relationship("Student", back_populates='class_')
Exemple #8
0
class College(db.Model):
    __tablename__ = 't_college'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(30))
    student = db.relationship("Student", back_populates='college')
Exemple #9
0
class Admin(db.Model):
    __tablename__ = 't_admin'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(10))
    passwd = db.Column(db.String(20))
    real_name = db.Column(db.String(20))
Exemple #10
0
class Student_State(db.Model):
    __tablename__ = 't_student_state'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20))

    student = db.relationship('Student', back_populates='student_state')