diff --git a/taskmanager/models.py b/taskmanager/models.py index e4ab563..11b7967 100644 --- a/taskmanager/models.py +++ b/taskmanager/models.py @@ -1,7 +1,17 @@ from taskmanager import db -class Table(db.Model): +class Task(db.Model): id = db.Column(db.Integer, primary_key=True) - variable1 = db.Column(db.Integer, nullable=False) - variable2 = db.Column(db.Integer, nullable=False) + name = db.Column(db.String, nullable=False) + desc = db.Column(db.String, nullable=True) + +class User(db.Model): + id = db.Column(db.Integer, primary_key=True) + username = db.Column(db.String, nullable=False) + contact = db.Column(db.String, nullable=False) + +class TaskUser(db.Model): + id = db.Column(db.Integer, primary_key=True) + taskid = db.Column(db.Integer, nullable=False) + userid = db.Column(db.Integer, nullable=False) diff --git a/taskmanager/routes.py b/taskmanager/routes.py index 4df4be4..ec7e818 100644 --- a/taskmanager/routes.py +++ b/taskmanager/routes.py @@ -5,15 +5,8 @@ from taskmanager.models import * @app.route('/', methods=['GET']) def index(): - if request.method == 'GET': - localvariable1 = "Placeholder1" - localvariable1 = "Placeholder2" - try: - return render_template('index.html', pagevariable1 = localvariable1, pagevariable2 = localvariable2 ) - except: - return 'Error retriving page' - else: - return 'HTTP request method not recogniezed' + tasks = Task.query.all() + return render_template('index.html', tasks = tasks) @app.route('/submit', methods=['POST', 'GET']) def submit():