Example #1
0
class User(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_type = db.Column(db.String(30))
    password = db.Column(db.String(1000))

    #user backref can be used in employeee table t extract  details
    employees = db.relationship('Employee', backref='user', lazy='dynamic')
Example #2
0
class Role(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(30))
    description = db.Column(db.String(2000))

    #role backref can be used in employeee table t extract  details
    employees = db.relationship('Employee', backref='role', lazy='dynamic')
Example #3
0
class User(db.Model,UserMixin):
	id = db.Column(db.Integer,primary_key=True)
	username = db.Column(db.String(20),unique=True,nullable=False)
	email = db.Column(db.String(20),unique=True,nullable=False)
	password = db.Column(db.String(20),nullable=False)
	def __repr__(self):
		return f"User('{self.username}','{self.email}')"
Example #4
0
class Student(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    firstname = db.Column(db.String(50), nullable=False)
    lastname = db.Column(db.String(50), nullable=False)
    grad_class = db.Column(
        db.Integer, nullable=False)  # we don't want to store fresh, soph, etc.

    # one to many with Student to Note
    #notes = db.relationship('Note', backref='student', lazy=True)

    def __repr__(self):
        return f"Note('{self.id}', '{self.firstname}', '{self.lastname}')"
Example #5
0
class Note(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    note_image = db.Column(db.String(20), nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    system_date = db.Column(db.DateTime,
                            nullable=False,
                            default=datetime.utcnow)
    content = db.Column(db.String(2000), nullable=True)

    # TODO: *** future elements to this model ***
    # student_id = db.Column(db.Integer, db.ForeignKey('student.id'), nullable=True)
    # begin_date = db.Column(db.DateTime, nullable=True)
    # end_date = db.Column(db.DateTime, nullable=True)

    def __repr__(self):
        return f"Note('{self.note_image}')"
Example #6
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(20), unique=True, nullable=False)
    email = db.Column(db.String(120), unique=True, nullable=False)
    image_file = db.Column(db.String(20),
                           nullable=False,
                           default='default.jpg')
    password = db.Column(db.String(60), nullable=False)

    # this is signifying the one to many relationship from User to Note
    # TODO: learn about the lazy indicator... as well as the backref
    notes = db.relationship('Note', backref='reviewer', lazy=True)

    # this needs some more explaination...
    # seems to be what shows up in the terminal window when we return an object of this type
    def __repr__(self):
        return f"User('{self.username}', '{self.email}', '{self.image_file}')"
Example #7
0
class Add(db.Model):
	id = db.Column(db.Integer, primary_key=True)
	classname = db.Column(db.String(20))
	#students = db.Column(db.Integer, unique=True, nullable=False)
	coordinator = db.Column(db.String(30))
	co_email = db.Column(db.String(30))
	stuname = db.Column(db.String(30))
	regno = db.Column(db.Integer,unique=True)
	mobileno = db.Column(db.Integer,unique=True)
	# def get_my_form(self):
	# 	from attendance.forms import AddForm
	# 	return AddForm()
	# def insertion():		
	# 	form = self.get_my_form()
	# 	num = form.students.data
	# 	stu[num]
	# 	regno[num]	
	# 	for i in range(num):
	def __repr__(self):
		return f"Add('{self.classname}','{self.coordinator}','{self.co_email}','{self.stuname}','{self.regno}','{self.mobileno}')"
Example #8
0
class Employee(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    role_id = db.Column(db.Integer, db.ForeignKey('role.id'))
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    department_id = db.Column(db.Integer, db.ForeignKey('department.id'))
    name = db.Column(db.String(50))

    #employee backref can be used in attendence table t extract employee detail
    attendance = db.relationship('Attendance',
                                 backref='employee',
                                 lazy='dynamic')
    work = db.relationship('Work', backref='employee', lazy='dynamic')
Example #9
0
class Attendance(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    employee_id = db.Column(db.Integer, db.ForeignKey('employee.id'))
    in_out = db.Column(db.String(30))
    DT = db.Column(db.DateTime, default=dt.now())