def task_list(request): tasks = get_user_tasks(user=request.user) c = RequestContext(request, { 'tasks': tasks, 'status_list': Status.objects.all() }) return render_to_response("tasks/list.html", c)
def list(request): result = Project.objects.all().order_by('name').filter(perms=request.user) project_list = [] if result: for project in result: if request.user.has_perm('projects.can_view'): project.tasks = get_user_tasks(user=request.user, project=project) project_list.append(project) c = RequestContext(request, { 'projects': project_list, }) return render_to_response("projects/list.html", c)
def index(request): result = Project.objects.all().order_by('start_date').filter(perms=request.user) project_list = [] if result: for project in result: if request.user.has_perm('projects.can_view'): project.tasks = get_user_tasks(user=request.user, project=project) project_list.append(project) c = RequestContext(request, { 'project_list': project_list, 'status_list': Status.objects.all() }) return render_to_response("projects/index.html", c)
def test_get_user_tasks(self): result = get_user_tasks(self.user, self.project, False) self.assertEqual(result[0].subject, 'Task One') result = get_user_tasks(self.user, self.project, True) self.assertEqual(result[0].subject, 'Task Two')