示例#1
0
class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False)
    date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    content = db.Column(db.Text, nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    def __repr__(self):
        return f"Post('{self.title}', '{self.date_posted}')"
示例#2
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    login = db.Column(db.String(128), nullable=False, unique=True)
    email = db.Column(db.String(length=120))
    fullname = db.Column(db.String(128), nullable=False)
    password = db.Column(db.String(255), nullable=False)
    group_user_id = db.Column(db.Integer, db.ForeignKey('usergroup.id'))
    Claims = db.relationship('Claim',
                             primaryjoin="Claim.source_user_id==User.id",
                             foreign_keys=[Claim.source_user_id],
                             backref=db.backref('user', lazy='joined'),
                             lazy='dynamic',
                             cascade='all, delete-orphan')
    Claims_executer = db.relationship(
        'Claim',
        primaryjoin="Claim.executer_user_id==User.id",
        foreign_keys=[Claim.executer_user_id],
        backref=db.backref('executer_user', lazy='joined'),
        lazy='dynamic',
        cascade='all, delete-orphan')
示例#3
0
class Poll(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    code = db.Column(db.String(8), nullable=False)
    date_polled = db.Column(db.DateTime,
                            nullable=False,
                            default=datetime.utcnow)
    preferrence = db.Column(db.Integer, nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    def __repr__(self):
        return f"Poll('{self.code}','{self.name}')"
示例#4
0
文件: models.py 项目: bumbiyada/Tomog
class Tables(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    manufacture_id = db.Column(db.Integer,
                               db.ForeignKey('manufactures.id'),
                               nullable=False)
    table_name = db.Column(db.String(128), nullable=False)
    horizont_range = db.Column(db.Integer())
    max_weight = db.Column(db.Integer())
    tomog = db.relationship('Tomog', backref='table', lazy=True)

    def __repr__(self):
        return '{}'.format(self.table_name)
示例#5
0
class Tracks(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.Text)
    intro = db.Column(db.Text)
    image = db.Column(db.String(100))
    message = db.Column(db.Text)
    paths = db.relationship('Path', backref='line', lazy=True)

    # rel = db.relationship('Post', backref = '', lazy = True)

    def __repr__(self):
        return f"Track('Track Number = {self.id}, Title = {self.title}')"
示例#6
0
文件: models.py 项目: bumbiyada/Tomog
class Generator(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    manufacture_id = db.Column(db.Integer,
                               db.ForeignKey('manufactures.id'),
                               nullable=False)
    generator_name = db.Column(db.String(128), nullable=False)
    power = db.Column(db.Integer())
    current = db.Column(db.Integer())
    voltage = db.Column(db.Integer())
    tomog = db.relationship('Tomog', backref='generator', lazy=True)

    def __repr__(self):
        return '{}'.format(self.generator_name)
示例#7
0
文件: models.py 项目: bumbiyada/Tomog
class Role(db.Model, RoleMixin):
    id = db.Column(db.Integer(), primary_key=True)
    name = db.Column(db.String(128), nullable=False)
    description = db.Column(db.String(255))
示例#8
0
class Usergroup(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    group_name = db.Column(db.String(128), nullable=False, unique=True)
    Users = db.relationship('User', backref=db.backref('usergroup', lazy=True))
class Question(db.Model):
    __tablename__ = 'Questions'

    id = db.Column(db.Integer, primary_key=True)
    exam = db.Column(db.String(1000), nullable=False)
    category = db.Column(db.String(1000), nullable=False)
    question = db.Column(db.String(1000), nullable=False)
    question_type = db.Column(db.String(1000), nullable=False)
    question_image = db.Column(db.String(1000), nullable=True)
    answer_1 = db.Column(db.String(2000), nullable=False)
    answer_2 = db.Column(db.String(2000), nullable=False)
    answer_3 = db.Column(db.String(2000), nullable=False)
    answer_4 = db.Column(db.String(2000), nullable=False)
    answers = db.Column(db.String(12000), nullable=False)
    source = db.Column(db.String(1000), nullable=False)

    def __repr__(self):
        return f"Question('{self.question}')"