taskapp/views/task.py
changeset 224 c41e38f36299
parent 223 b592ed0b12b1
child 226 b4a3ec34c061
--- a/taskapp/views/task.py	Thu Jan 06 10:05:58 2011 +0530
+++ b/taskapp/views/task.py	Thu Jan 06 11:42:49 2011 +0530
@@ -66,7 +66,24 @@
         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})