Exemple #1
0
def kanbanpage(request, tasklist_to_show_id=None):
    user_mail = request.session['user_mail']

    if tasklist_to_show_id:
        tasklist = TaskList.objects.get(id=tasklist_to_show_id)
        tasks = SimpleTask.get_tasks_from_tasklist(tasklist)
    else:
        tasks = SimpleTask.get_all_tasks_by_user(user_mail)

    initial_backlog = SimpleTask.get_kanban_backlog_tasks(tasks)

    data_dict_obj = BuildTemplateContext('all', initial_backlog)

    final_backlog = data_dict_obj.get_data()

    all_tasklists = TaskList.get_tasklists_from_user(user_mail)

    final_backlog['all_tasklists'] = all_tasklists

    in_progress = SimpleTask.objects.filter(tasklist__user__email=user_mail,
                                            in_progress=True)

    finished = SimpleTask.objects.filter(tasklist__user__email=user_mail,
                                         in_progress=False,
                                         is_done=True)

    context = {"backlog": final_backlog,
               "in_progress": in_progress,
               "finished": finished}

    return render(request, "kanban.html", context)
Exemple #2
0
def coveys_matrix_page(request, tasklist_to_show_id=None):
    user_mail = request.session['user_mail']

    if tasklist_to_show_id:
        tasklist = TaskList.objects.get(id=tasklist_to_show_id)
        tasks = SimpleTask.get_tasks_from_tasklist(tasklist)
    else:
        tasks = SimpleTask.get_all_tasks_by_user(user_mail)

    backlog_tasks = SimpleTask.get_matrix_backlog_tasks(tasks)

    backlog_obj = BuildTemplateContext('all', backlog_tasks)
    final_backlog = backlog_obj.get_data()

    all_user_tasks = SimpleTask.get_all_tasks_by_user(user_mail)

    matrix_obj = BuildTemplateContext('matrix', all_user_tasks)
    matrix_data = matrix_obj.get_data()

    all_tasklists = TaskList.get_tasklists_from_user(user_mail)

    final_backlog['all_tasklists'] = all_tasklists

    return render(request, "stephen_covey_matrix.html", {
        'backlog': final_backlog,
        'matrix_data': matrix_data
    })
Exemple #3
0
def tasks_dashboard(request, tasklist_to_show_id=None, display='all'):

    user_mail = request.session['user_mail']
    if tasklist_to_show_id:
        tasklist = TaskList.get_tasklist_by_id(id=tasklist_to_show_id)
        tasks = SimpleTask.get_tasks_from_tasklist(tasklist)
    else:
        tasks = SimpleTask.get_all_tasks_by_user(user_mail)

    data_dict_obj = BuildTemplateContext(display, tasks)

    data_dict = data_dict_obj.get_data()

    all_tasklists = TaskList.get_tasklists_from_user(user_mail)

    data_dict['all_tasklists'] = all_tasklists

    if tasklist_to_show_id:
        data_dict['tasklist_to_show'] = tasklist

    return render(request, "tasks.html", data_dict)
Exemple #4
0
 def test_get_tasks_from_tasklist(self):
     tasks = SimpleTask.get_tasks_from_tasklist(self.tasklist_1)
     for task in tasks:
         self.assertTrue(isinstance(task, SimpleTask))
         self.assertEquals(task.tasklist, self.tasklist_1)