56 form = CreateTaskForm() |
56 form = CreateTaskForm() |
57 context.update({'form':form}) |
57 context.update({'form':form}) |
58 return render_to_response('task/create.html', context) |
58 return render_to_response('task/create.html', context) |
59 else: |
59 else: |
60 return show_msg(user, 'You are not authorised to create a task.') |
60 return show_msg(user, 'You are not authorised to create a task.') |
|
61 |
|
62 def browse_tasks(request): |
|
63 |
|
64 open_tasks = Task.objects.filter(status="OP") |
|
65 working_tasks = Task.objects.filter(status="WR") |
|
66 comp_tasks = Task.objects.filter(status="CM") |
|
67 |
|
68 context = {"open_tasks": open_tasks, |
|
69 "working_tasks": working_tasks, |
|
70 "comp_tasks": comp_tasks, |
|
71 } |
|
72 |
|
73 user = request.user |
|
74 if not user.is_authenticated(): |
|
75 return render_to_response("task/browse.html") |
|
76 |
|
77 profile = user.get_profile() |
|
78 |
|
79 can_approve = True if profile.rights in ["MG", "DC"] else False |
|
80 unpub_tasks = Task.objects.filter(status="UP").exclude(status="DL") |
|
81 if can_approve: |
|
82 context.update({"unpub_tasks": unpub_tasks}) |
|
83 |
|
84 context.update({"user": user, |
|
85 "profile": profile, |
|
86 }) |
|
87 |
|
88 return render_to_response("task/browse.html", context) |
|
89 |
61 |
90 |
62 def view_task(request, tid): |
91 def view_task(request, tid): |
63 """ get the task depending on its tid and display accordingly if it is a get. |
92 """ get the task depending on its tid and display accordingly if it is a get. |
64 check for authentication and add a comment if it is a post request. |
93 check for authentication and add a comment if it is a post request. |
65 """ |
94 """ |