From df42a47ea20ec14a5716b5b23d4595239a260114 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Tue, 19 Mar 2019 16:19:00 +0000 Subject: add task overview to user landing page --- app/main/routes.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'app/main') diff --git a/app/main/routes.py b/app/main/routes.py index e69282c..662e14a 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -1,11 +1,20 @@ # -*- coding: utf-8 -*- from flask import render_template -from flask_login import login_required +from flask_login import current_user from app.main import bp +from app.models import Task + @bp.route("/") @bp.route("/index") def index(): + if current_user.is_authenticated: + user_id = current_user.id + tasks = Task.query.filter_by(annotator_id=user_id).all() + tasks_done = [t for t in tasks if t.done] + tasks_todo = [t for t in tasks if not t.done] + return render_template("index.html", title="Home", + tasks_done=tasks_done, tasks_todo=tasks_todo) return render_template("index.html", title="Home") -- cgit v1.2.3