예제 #1
0
class License(db.Model):
    __tablename__ = 'license'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64))
    license_str = db.Column(db.String(128))
    project_name = db.Column(db.String(128))
    time = db.Column(db.String(28))
예제 #2
0
class Severity(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), nullable=False, unique=True)
    weight = db.Column(db.Integer, nullable=False)

    def __init__(self, name, weight):
        self.name = name
        self.weight = weight
예제 #3
0
class Reminder(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user = db.Column(db.String(255), nullable=False)
    notified = db.Column(db.Boolean, default=0)
    date_added = db.Column(db.DateTime, default=datetime.now)

    def __init__(self, user, notified):
        self.user = user
        self.notified = notified
예제 #4
0
class Category(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(
        db.String(255),
        nullable=True,
    )

    def __init__(self, name):
        self.name = name
예제 #5
0
파일: models.py 프로젝트: 10969aimyon/blog1
class Comment(db.Model):
    __tablename__ = 'comment'
    id = db.Column(db.INTEGER, primary_key=True, autoincrement=True)
    content = db.Column(db.Text, nullable=False)
    user_id = db.Column(db.INTEGER, db.ForeignKey('user.id'))
    user = db.relationship('User', backref=db.backref('comments'))

    question_id = db.Column(db.INTEGER, db.ForeignKey('question.id'))
    question = db.relationship('Question', backref=db.backref('comments'))
예제 #6
0
파일: models.py 프로젝트: 10969aimyon/blog1
class Question(db.Model):
    __tablename__ = 'question'
    id = db.Column(db.INTEGER, primary_key=True, autoincrement=True)
    title = db.Column(db.String(100), nullable=False)
    content = db.Column(db.Text, nullable=False)
    create_time = db.Column(db.DATETIME, default=datetime.now)

    author_id = db.Column(db.INTEGER, db.ForeignKey('user.id'))
    author = db.relationship('User', backref=db.backref('questions'))
예제 #7
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(255), nullable=False, unique=True)
    name = db.Column(db.String(255), nullable=False)
    branch = db.Column(db.ForeignKey("branch.id"), nullable=False)

    def __init__(self, email, name, branch):
        self.email = email
        self.name = name
        self.branch = branch
예제 #8
0
class User(db.Model):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64))
    passwd = db.Column(db.String(64))
    email = db.Column(db.String(64))
    time = db.Column(db.String(32))

    # def __init__(self,username,passwd,email,time):
    #     self.username = username
    #     self.passwd = passwd
    #     self.email = email
    #     self.time = time

    # def __repr__(self):
    #     return "{},{},{}".format(self.username,self.passwd,self.email)
    def hash_password(self, password):
        self.passwd = pwd_context.encrypt(password)

    def verify_password(self, password):
        return pwd_context.verify(password, self.passwd)
예제 #9
0
class Rootpw(db.Model):
    __tablename__ = 'rootpw'
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64))
    encode_pw = db.Column(db.String(32))
    decode_pw = db.Column(db.String(32))
    project_name = db.Column(db.String(128))
    time = db.Column(db.String(28))

    # def __init__(self,username,project_name,time):
    #     self.username = username
    #     self.project_name = project_name
    #     self.time = time
    #
    # def __repr__(self):
    #     return self.encode_pw


#db.create_all()

#
# from sqlalchemy.orm import sessionmaker
# from sqlalchemy.ext.declarative import declarative_base
# Base = declarative_base()
# class User(Base):
#     __tablename__='user'
#     id = Column(INTEGER(16),primary_key=True)
#     name = Column(String(16))
#     passwd = Column(String(16))
#     email = Column(String(32))
#
#     def hash
#
# engine = create_engine(db_name)
# DB_Session = sessionmaker(bind=engine)
예제 #10
0
class Bike(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    plate_number = db.Column(db.String(100), nullable=False, unique=True)
    email = db.Column(db.String(255), nullable=False)
    branch = db.Column(db.Integer, nullable=False)
    serial_number = db.Column(db.String(100), nullable=False, unique=True)
    date_added = db.Column(db.DateTime, default=datetime.now)

    def __init__(self, plate_number, email, branch, serial_number):
        self.plate_number = plate_number
        self.email = email
        self.branch = branch
        self.serial_number = serial_number
예제 #11
0
class BranchReports(db.Model):
    """we need to refactor db to add each branch for each of the categrory"""
    id = db.Column(db.Integer, primary_key=True)
    branch = db.Column(db.ForeignKey("branch.id"), nullable=False)
    severity = db.Column(db.ForeignKey('severity.id'), nullable=True)
    category = db.Column(db.ForeignKey("category.id"), nullable=True)
    comments = db.Column(db.Text)
    date_added = db.Column(db.DateTime, default=datetime.now)

    def __init__(self, branch, severity, category, comments):
        self.branch = branch
        self.severity = severity
        self.category = category
        self.comments = comments
예제 #12
0
class Branch(db.Model):
    id = db.Column(db.Integer, primary_key=True, unique=True)
    name = db.Column(db.String(255), nullable=False, unique=True)

    def __init__(self, name):
        self.name = name
예제 #13
0
파일: models.py 프로젝트: 10969aimyon/blog1
class User(db.Model):
    __tablename__ = 'user'
    id = db.Column(db.INTEGER, primary_key=True, autoincrement=True)
    username = db.Column(db.String(50), nullable=False)
    password = db.Column(db.String(100), nullable=False)
    telephone = db.Column(db.String(11), nullable=False)