added a form in the template, for users to submit work
authorNishanth Amuluru <nishanth@fossee.in>
Thu, 06 Jan 2011 10:05:58 +0530
changeset 223 b592ed0b12b1
parent 222 eeef395a4e02
child 224 c41e38f36299
added a form in the template, for users to submit work
taskapp/views/task.py
templates/task/report.html
--- a/taskapp/views/task.py	Thu Jan 06 00:17:53 2011 +0530
+++ b/taskapp/views/task.py	Thu Jan 06 10:05:58 2011 +0530
@@ -3,7 +3,7 @@
 from django.http import HttpResponse, Http404
 from django.shortcuts import render_to_response, redirect
 
-from pytask.taskapp.models import User, Task, Comment, Request, Notification
+from pytask.taskapp.models import User, Task, Comment, Request, Notification, WorkReport
 from pytask.taskapp.utilities.task import getTask
 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
@@ -53,12 +53,13 @@
 
     can_upload = True if user in task.assigned_users.all() else False
 
-    old_reports = WorkReport.workreport_report.all()
+    old_reports = task.workreport_report.all()
 
     context = {
         'user': user,
         'task': task,
         'old_reports': old_reports,
+        'can_upload': can_upload,
     }
 
     if request.method == "POST":
--- a/templates/task/report.html	Thu Jan 06 00:17:53 2011 +0530
+++ b/templates/task/report.html	Thu Jan 06 10:05:58 2011 +0530
@@ -10,6 +10,11 @@
 {{rep.submitted_by}} | {{rep.attachment}} <br />
 {% endfor %}
 {% endif %}
-some data
 <hr />
+{% if can_upload %}
+Submit a report: <br />
+<form action='' method=post enctype="multipart/form-data">
+{{ form.as_p }}
+</form>
+{% endif %}
 {% endblock %}