aboutsummaryrefslogtreecommitdiff
path: root/app/main/routes.py
blob: 662e14ae332f9eae9e5cea9418f704357cab3d83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- coding: utf-8 -*-

from flask import render_template
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")