49 task = getTask(tid) |
49 task = getTask(tid) |
50 |
50 |
51 if not task.status == "WR": |
51 if not task.status == "WR": |
52 return show_msg(user, "The task is not in a stage to upload content", task_url, "view the task") |
52 return show_msg(user, "The task is not in a stage to upload content", task_url, "view the task") |
53 |
53 |
54 if not user in task.assigned_users.all(): |
54 can_upload = True if user in task.assigned_users.all() else False |
55 return show_msg(user, "You are not authorised to upload data to this task", task_url, "view the task") |
55 |
56 |
56 old_reports = WorkReport.workreport_report.all() |
57 |
57 |
58 context = { |
58 context = { |
59 'user':user, |
59 'user': user, |
60 'task':task, |
60 'task': task, |
|
61 'old_reports': old_reports, |
61 } |
62 } |
62 |
63 |
63 if request.method == "POST": |
64 if request.method == "POST": |
|
65 if not can_upload: |
|
66 return show_msg(user, "You are not authorised to upload data to this task", task_url, "view the task") |
|
67 |
64 pass |
68 pass |
65 else: |
69 else: |
66 form = WorkReportForm() |
70 form = WorkReportForm() |
|
71 context.update("form":form) |
67 return render_to_response('task/report.html', context) |
72 return render_to_response('task/report.html', context) |
68 |
73 |
69 |
74 |
70 def publish_task(request, tid): |
75 def publish_task(request, tid): |
71 """ check if user is the reviewer and also if the task status is UP. |
76 """ check if user is the reviewer and also if the task status is UP. |