예제 #1
0
파일: base.py 프로젝트: Diolog/IED
class Base(db.Model):
    __abstract__ = True
    create_timestamp = db.Column(db.DateTime, default=datetime.utcnow)
    update_timestamp = db.Column(db.DateTime,
                                 default=datetime.utcnow,
                                 onupdate=datetime.utcnow)
    is_delete = db.Column(db.Integer, default=1)  # 1 正常, 0 已删除
예제 #2
0
class Article(Base):
    id = db.Column(db.String(25),
                   primary_key=True,
                   default=generate_resource_key)
    name = db.Column(db.String(255))
    real_url = db.Column(db.String(255), nullable=False)
    resource_url = db.Column(db.String(255), nullable=False)
    class_id = db.Column(db.Integer, nullable=False)
예제 #3
0
class User(Base):
    id = db.Column(db.String(25), primary_key=True, default=generate_user_key)
    username = db.Column(db.String(25))
    password_hash = db.Column(db.String(255))
    is_manager = db.Column(db.Integer)  # 0 不是管理员 1 是管理员

    def set_password(self, password):
        self.password_hash = generate_password_hash(password)

    def validate_password(self, password):
        return check_password_hash(self.password_hash, password)
예제 #4
0
파일: resources.py 프로젝트: Diolog/IED
class Resource(Base):
    id = db.Column(db.String(25),
                   primary_key=True,
                   default=generate_resource_key)
    name = db.Column(db.String(255))
    real_url = db.Column(db.String(255), nullable=False)
    resource_url = db.Column(db.String(255), nullable=False)
    class_id = db.Column(db.Integer, nullable=False)
    file_md5 = db.Column(db.String(35), nullable=False, unique=True)
    description = db.Column(db.String(255), default='')
    size = db.Column(db.Float, nullable=False)
예제 #5
0
파일: log.py 프로젝트: Diolog/IED
class Log(Base):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    ip = db.Column(db.String(50))
    url = db.Column(db.String(255))
예제 #6
0
class ArticleClass(Base):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(20), unique=True)
    level = db.Column(db.Integer)
    parentId = db.Column(db.Integer)