Beispiel #1
0
class Follow(db.model):
    __tablename__ = "follow"

    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.Foreignkey('users.id'))
    follower_id = db.Column(db.Integer, db.Foreignkey('users.id'))

    user = db.relationship('User', foreign_keys=user_id)
    follower = db.relationship('User', foreign_keys=follower_id)
Beispiel #2
0
class Nominee(db.Model):
    __tablename__ = 'nominee'
    id = db.Column(db.Integer,
                   primary_key=True,
                   unique=true,
                   autoincrement=True)
    roll = db.Column(db.Integer, db.Foreignkey(student.roll))
    course_id = db.Column(db.Integer, db.Foreignkey(Course_id))

    def __init__(self, roll, course_id):
        self.roll = roll
        self.course_id = course_id
Beispiel #3
0
class Students(db.Model):
    id = db.Column(db.Integer, primary_key=True, db.Foreignkey('users.id'))
    campus = db.Column(db.String(5))
    # AM, BL, CB, ...
    school = db.Column(db.String(5))
    # EN, BT, ...
    program = db.Column(db.String(5))
    # Undergraduate, ...
    name = db.Column(db.String(60))
    gradyear = db.Column(db.Date)
Beispiel #4
0
class Post(object):
    __tablename__ = "posts"

    id = db.Column(db.Integer, primary_key=True)
    content = db.Column(db.Text)
    user_id = db.Column(db.Integer, db.Foreignkey('user_id'))

    user = db.relationship('User', foreign_keys=user_id)

    def __init__(self, content, user_id):
        self.content = content
        self.user_id = user_id

    def __repr__():
        return "<Post %r>" % self.id
Beispiel #5
0
class PayrollsModel(db.Model):
    __tablename__ = 'payrolls'
    id = db.Column(db.Integer, primary=True)
    overtime = db.Column(db.Float)
    month = db.Column(db.String(20), nullable=False)
    loan_deducted = db.Column(db.Float)
    advance_pay = db.Column(db.Float)
    gross_salary = db.Column(db.Float)
    personal_relief = db.Column(db.Float)
    taxable_amount = db.Column(db.Float)
    PAYE = db.Column(db.Float)
    NHIF = db.Column(db.Float)
    NSSF = db.Column(db.Float)
    net_salary = db.Column(db.Float)
    employee_id = db.Column(db.Integer, db.Foreignkey('employees.id'))

    # create
    def insert_to_db(self):
        db.session.add(self)
        db.session.commit()
Beispiel #6
0
class Staff(db.Model):
    id = db.Column(db.Integer, primary_key=True, db.Foreignkey('users.id'))
    campus = db.Column(db.String(5))
    dept = db.Column(db.String(5))
    empid = db.Column(db.Integer)
Beispiel #7
0
class Orgaccess(db.Model):
    uid = db.Column(db.Integer, primary_key=True, db.Foreignkey('users.id'))
    oid = db.Column(db.Integer,
                    primary_key=True,
                    db.Foreignkey('organisation.id'))
    perm = db.Column(db.Integer)