summaryrefslogtreecommitdiff
path: root/taskapp/views/task.py
diff options
context:
space:
mode:
authorNishanth Amuluru2011-01-05 23:51:10 +0530
committerNishanth Amuluru2011-01-05 23:51:10 +0530
commit94562031fcfbf0b8cb9d8dcdcb275c893fe68095 (patch)
treef3bc7a344dbb292eb79f4535f7103b336a17c86b /taskapp/views/task.py
parentdfc9b3caf56c119d10c002c321a8fcd1d7ff8406 (diff)
downloadpytask-94562031fcfbf0b8cb9d8dcdcb275c893fe68095.tar.gz
pytask-94562031fcfbf0b8cb9d8dcdcb275c893fe68095.tar.bz2
pytask-94562031fcfbf0b8cb9d8dcdcb275c893fe68095.zip
added a submit_report link for each task
Diffstat (limited to 'taskapp/views/task.py')
-rw-r--r--taskapp/views/task.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/taskapp/views/task.py b/taskapp/views/task.py
index 396ba5d..9a956a6 100644
--- a/taskapp/views/task.py
+++ b/taskapp/views/task.py
@@ -5,7 +5,7 @@ from django.shortcuts import render_to_response, redirect
from pytask.taskapp.models import User, Task, Comment, Request, Notification
from pytask.taskapp.utilities.task import getTask
-from pytask.taskapp.forms.task import TaskCreateForm, AddReviewerForm, AddTaskForm, ChoiceForm, AssignPyntForm, RemoveUserForm, EditTaskForm, ClaimTaskForm
+from pytask.taskapp.forms.task import TaskCreateForm, AddReviewerForm, AddTaskForm, ChoiceForm, AssignPyntForm, RemoveUserForm, EditTaskForm, ClaimTaskForm, WorkReportForm
from pytask.taskapp.events.task import createTask, reqReviewer, publishTask, addSubTask, addDep, addClaim, assignTask, updateTask, removeTask, removeUser, assignPynts, completeTask, closeTask, addReviewer, deleteTask
from pytask.taskapp.views.user import show_msg
from pytask.taskapp.utilities.user import get_user
@@ -39,6 +39,34 @@ def show_textbooks(request):
}
return render_to_response('task/browse.html', context)
+def upload_work(request, tid):
+ """ Check if the work is in WR state and the user is in assigned_users.
+ """
+
+ task_url = "/task/view/tid=%s"%tid
+
+ user = get_user(request.user) if request.user.is_authenticated() else request.user
+ task = getTask(tid)
+
+ if not task.status == "WR":
+ return show_msg(user, "The task is not in a stage to upload content", task_url, "view the task")
+
+ if not user in task.assigned_users.all():
+ return show_msg(user, "You are not authorised to upload data to this task", task_url, "view the task")
+
+
+ context = {
+ 'user':user,
+ 'task':task,
+ }
+
+ if request.method == "POST":
+ pass
+ else:
+ form = WorkReportForm()
+ return render_to_response('task/report.html', context)
+
+
def publish_task(request, tid):
""" check if user is the reviewer and also if the task status is UP.
"""