model.py 688 字节
Newer Older
梦想橡皮擦's avatar
梦想橡皮擦 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
from app import db


class EntityBase(object):
    def to_json(self):
        fields = self.__dict__
        if "_sa_instance_state" in fields:
            del fields["_sa_instance_state"]

        return fields


class School(db.Model, EntityBase):
    """
    表名,字段名
    """
    __tablename__ = "school_list"
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255))
    province = db.Column(db.String(255))
    city = db.Column(db.String(255))
    feature = db.Column(db.String(255))
    hotValue = db.Column(db.String(255))
    pic = db.Column(db.String(255))
    category = db.Column(db.String(255))
    batchTimes = db.Column(db.String(255))