Skip to content

Commit

Permalink
Edit models & create base app routes
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-becerra committed Aug 31, 2017
1 parent 6c1d7db commit a1be175
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 15 deletions.
42 changes: 42 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,48 @@
from app import app, db
from models import Student, Teacher, Attendance

# Main View
@app.route('/')
def index():
return render_template('index.html')


# Teacher Login
@app.route('/teacher_login', methods=["POST", "GET"])
def login():
return render_template('/teacher_login.html')


# Teacher Signup
@app.route('/teacher_signup', methods=["POST", "GET"])
def login():
return render_template('/teacher_login.html')


# Logout
@app.route('/logout')
def logout():
del session['email']
return redirect('/')


# Student Login
@app.route('/student_login', methods=["POST", "GET"])
def student_login():
return render_template('student_login.html')


# Attendance List
@app.route('/attendance_list', methods=["POST", "GET"])
def attendance_list():
return render_template('attendance_list.html')


# Student List
@app.route('/student_list', methods=["POST", "GET"])
def student_list():
return render_template('student_list.html')



if __name__ == "__main__":
Expand Down
26 changes: 11 additions & 15 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,32 @@

class Student(db.Model):
id = db.Column(db.Integer, primary_key=True)
firstName = db.Column(db.String(120))
lastName = db.Column(db.String(120))
first_name = db.Column(db.String(120))
last_name = db.Column(db.String(120))
pin = db.Column(db.Integer)
cohort = db.Column(db.Integer)
city = db.Column(db.String(120))
attendance_date = db.relationship("Attendance", backref="owner")


def __init__(self, firstName, lastName, pin=0000, cohort=1,city="Miami"):
self.firstName = firstName
self.lastName = lastName
def __init__(self, first_name, last_name, pin=0000, cohort=1, city="Miami"):
self.first_name = first_name
self.last_name = last_name
self.pin = pin
self.cohort = cohort
self.city = city


# if pub_date == None:
# pub_date = datetime.now().strftime("%Y-%m-%d %I:%M:%S %p")
# self.pub_date = pub_date


class Teacher(db.Model):
id = db.Column(db.Integer, primary_key=True)
firstName = db.Column(db.String(120))
lastName = db.Column(db.String(120))
first_name = db.Column(db.String(120))
last_name = db.Column(db.String(120))
email = db.Column(db.String(120))
password = db.Column(db.String(120))

def __init__(self, firstName, lastName, email, password):
self.firstName = firstName
self.lastName = lastName
def __init__(self, first_name, last_name, email, password):
self.first_name = first_name
self.last_name = last_name
self.email = email
self.password = password

Expand Down

0 comments on commit a1be175

Please sign in to comment.