# HG changeset patch # User Nishanth Amuluru # Date 1294744867 -19800 # Node ID daca865314e7f2b48cd6a0deb8e06bc83982ac58 # Parent da4c6b1cec7dd7a9b6e477b5f7f36b801e695f80 view_work is now working diff -r da4c6b1cec7d -r daca865314e7 pytask/taskapp/urls.py --- a/pytask/taskapp/urls.py Tue Jan 11 14:57:16 2011 +0530 +++ b/pytask/taskapp/urls.py Tue Jan 11 16:51:07 2011 +0530 @@ -3,7 +3,8 @@ from pytask.taskapp.views import create_task, view_task, claim_task, \ select_user, edit_task, create_textbook, view_textbook, \ browse_tasks, edit_textbook, approve_task, approved_task,\ - browse_textbooks, approve_textbook, approved_textbook, addreviewer + browse_textbooks, approve_textbook, approved_textbook, addreviewer,\ + view_report, view_work from pytask.views import under_construction @@ -17,6 +18,8 @@ (r'^approve/tid=(\w+)$', approve_task), (r'^approved/tid=(\w+)$', approved_task), (r'^addreviewer/tid=(\w+)$', addreviewer), + (r'^view/work/tid=(\w+)$', view_work), + (r'^view/report/rid=(\w+)$', view_report), (r'^browse/$', browse_tasks), (r'^textbook/create/$', create_textbook), diff -r da4c6b1cec7d -r daca865314e7 pytask/taskapp/views.py --- a/pytask/taskapp/views.py Tue Jan 11 14:57:16 2011 +0530 +++ b/pytask/taskapp/views.py Tue Jan 11 16:51:07 2011 +0530 @@ -280,8 +280,9 @@ reviewer_choices = User.objects.filter(is_active=True).\ exclude(reviewing_tasks__uniq_key=tid).\ exclude(claimed_tasks__uniq_key=tid).\ - exclude(approved_tasks__uniq_key=tid).\ + exclude(selected_tasks__uniq_key=tid).\ exclude(created_tasks__uniq_key=tid) + choices = ((a_user.id,a_user.username) for a_user in reviewer_choices) label = "Reviewer" @@ -302,6 +303,41 @@ context.update({"form": form}) return render_to_response("task/addreviewer.html", context) +def view_work(request, tid): + + task_url = "/task/view/tid=%s"%tid + task = getTask(tid) + + user = request.user + old_reports = task.reports.all() + + context = {"task": task, + "old_reports": old_reports, + } + + if not user.is_authenticated(): + return render_to_response("/task/view_work.html", context) + + profile = user.get_profile() + + context.update({"user": user, + "profile": profile, + }) + + context.update(csrf(request)) + + working_users = task.selected_users.all() + is_working = True if user in working_users else False + + context.update({"is_working": is_working}) + + return render_to_response("task/view_work.html", context) + +@login_required +def view_report(request, rid): + pass + + @login_required def create_textbook(request): diff -r da4c6b1cec7d -r daca865314e7 pytask/templates/task/view.html --- a/pytask/templates/task/view.html Tue Jan 11 14:57:16 2011 +0530 +++ b/pytask/templates/task/view.html Tue Jan 11 16:51:07 2011 +0530 @@ -87,13 +87,7 @@ View claims {% endif %} - {% if can_assign_pynts %} - Request assign pynts and mark the task as complete - {% endif %} - - {% if is_selected %} - Submit Work - {% endif %} + View submitted work reports
{% if comments %} diff -r da4c6b1cec7d -r daca865314e7 pytask/templates/task/view_work.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pytask/templates/task/view_work.html Tue Jan 11 16:51:07 2011 +0530 @@ -0,0 +1,23 @@ +{% extends 'base.html' %} +{% block title %} + {{task.title}} +{% endblock %} +{% block content %} +{% if not old_reports %} +There are no reports submitted as of now
+{% else %} + +{% for rep in old_reports %} + + + + + +{% endfor %} +
{{rep.submitted_by}}{{rep.data}}{{rep.attachment.name}}
+{% endif %} +{% if is_working %} +Submit report +
+{% endif %} +{% endblock %}