示例#1
0
class Student(db.Model):
    __tablename__ = "students"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(20), nullable=False)
    score = db.Column(db.Float, nullable=False)
    school_id = db.Column(db.Integer,
                          db.ForeignKey("schools.id"),
                          nullable=False)
示例#2
0
文件: models.py 项目: lucool/project
class Student(db.Model):  # 学生模型
    __tablename__ = "students"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(20), nullable=False)
    score = db.Column(db.Float, nullable=False)
示例#3
0
文件: models.py 项目: lucool/project
class User(db.Model):
    __tablename__ = "users"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    username = db.Column(db.String(20), nullable=False)
    password = db.Column(db.String(20), nullable=False)
示例#4
0
文件: models.py 项目: lucool/project
class Fruit(db.Model):
    __tablename__ = "fruits"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(20), nullable=False)
    price = db.Column(db.Float, nullable=False)
示例#5
0
class School(db.Model):
    __tablename__ = "schools"
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(20), nullable=False)
    address = db.Column(db.String(50), nullable=False)
    students = db.relationship("Student", backref="sch")