summaryrefslogtreecommitdiff
path: root/taskapp/views
diff options
context:
space:
mode:
authorNishanth Amuluru2011-01-06 11:42:49 +0530
committerNishanth Amuluru2011-01-06 11:42:49 +0530
commit47416d529965ee1d21aa240d197fc79cb4970fa7 (patch)
treea8b5afacbe8c17c45b4daeacb60bf7f8998d63b9 /taskapp/views
parent86e84a94a6b1e5e86e78459b06a9d618f76dcbb0 (diff)
downloadpytask-47416d529965ee1d21aa240d197fc79cb4970fa7.tar.gz
pytask-47416d529965ee1d21aa240d197fc79cb4970fa7.tar.bz2
pytask-47416d529965ee1d21aa240d197fc79cb4970fa7.zip
added saving of attachments
Diffstat (limited to 'taskapp/views')
-rw-r--r--taskapp/views/task.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/taskapp/views/task.py b/taskapp/views/task.py
index c5e7b04..1bb0453 100644
--- a/taskapp/views/task.py
+++ b/taskapp/views/task.py
@@ -66,7 +66,24 @@ def upload_work(request, tid):
if not can_upload:
return show_msg(user, "You are not authorised to upload data to this task", task_url, "view the task")
- pass
+ form = WorkReportForm(request.POST, request.FILES)
+
+ if form.is_valid():
+ r = WorkReport(attachment = form.cleaned_data['remarks'],
+ remarks = form.cleaned_data['remarks'],
+ revision = old_reports.count(),
+ task = task,
+ submitted_by = user,
+ created_at = datetime.now(),
+ )
+
+ r.save()
+ return redirect(task_url)
+
+ else:
+ context.update({"form":form})
+ return render_to_response('task/report.html', context)
+
else:
form = WorkReportForm()
context.update({"form":form})