aboutsummaryrefslogtreecommitdiff
path: root/app/main/routes.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/main/routes.py')
-rw-r--r--app/main/routes.py11
1 files changed, 10 insertions, 1 deletions
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")