# HG changeset patch # User Nishanth Amuluru # Date 1294253117 -19800 # Node ID a3de0d3c60a35d8c53fe625bc249fc073389e533 # Parent 807e4b701a20547d9819d4b723c015301d1d2c3b created form and created basic template for work report diff -r 807e4b701a20 -r a3de0d3c60a3 taskapp/views/task.py --- a/taskapp/views/task.py Wed Jan 05 23:51:10 2011 +0530 +++ b/taskapp/views/task.py Thu Jan 06 00:15:17 2011 +0530 @@ -51,19 +51,24 @@ 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") + can_upload = True if user in task.assigned_users.all() else False + old_reports = WorkReport.workreport_report.all() context = { - 'user':user, - 'task':task, + 'user': user, + 'task': task, + 'old_reports': old_reports, } if request.method == "POST": + if not can_upload: + return show_msg(user, "You are not authorised to upload data to this task", task_url, "view the task") + pass else: form = WorkReportForm() + context.update("form":form) return render_to_response('task/report.html', context) diff -r 807e4b701a20 -r a3de0d3c60a3 templates/task/report.html --- a/templates/task/report.html Wed Jan 05 23:51:10 2011 +0530 +++ b/templates/task/report.html Thu Jan 06 00:15:17 2011 +0530 @@ -3,5 +3,13 @@ {{task.title}} {% endblock %} {% block content %} - +{% if not old_reports %} +There are no reports submitted as of now +{% else %} +{% for rep in old_reports %} +{{rep.submitted_by}} | {{rep.attachment}}
+{% endfor %} +{% endif %} +some data +
{% endblock %} diff -r 807e4b701a20 -r a3de0d3c60a3 urls.py --- a/urls.py Wed Jan 05 23:51:10 2011 +0530 +++ b/urls.py Thu Jan 06 00:15:17 2011 +0530 @@ -1,67 +1,3 @@ -from django.conf.urls.defaults import * - -# Uncomment the next two lines to enable the admin: -from django.contrib import admin -admin.autodiscover() - -from pytask.taskapp.views import user as userViews -from pytask.taskapp.views import task as taskViews - -from pytask.taskapp.forms.user import RegistrationFormCustom -from registration.views import register - -urlpatterns = patterns('', - # Example: - # (r'^pytask/', include('pytask.foo.urls')), - - # Uncomment the admin/doc line below and add 'django.contrib.admindocs' - # to INSTALLED_APPS to enable admin documentation: - # (r'^admin/doc/', include('django.contrib.admindocs.urls')), - - (r'^images/(?P.*)$', 'django.views.static.serve', - {'document_root': './images/'}), - - (r'^$', userViews.homepage), - - (r'^task/browse/$', taskViews.browse_tasks), - (r'^task/view/tid=(\w+)$', taskViews.view_task), - (r'^task/create/$', taskViews.create_task), - (r'^task/publish/tid=(\w+)/$', taskViews.publish_task), - (r'^task/addreviewer/tid=(\w+)$', taskViews.add_reviewer), - (r'^task/edit/tid=(\w+)$', taskViews.edit_task), - (r'^task/claim/tid=(\w+)$', taskViews.claim_task), - (r'^task/assign/tid=(\w+)$', taskViews.assign_task), - (r'^task/remuser/tid=(\w+)$', taskViews.rem_user), - (r'^task/addtask/tid=(\w+)$', taskViews.add_tasks), - (r'^task/remtask/tid=(\w+)$', taskViews.remove_task), - (r'^task/assignpynts/tid=(\w+)$', taskViews.assign_pynts), - (r'^task/complete/tid=(\w+)$', taskViews.complete_task), - (r'^task/close/tid=(\w+)$', taskViews.close_task), - (r'^task/delete/tid=(\w+)$', taskViews.delete_task), - - (r'^admin/', include(admin.site.urls)), - - url(r'^accounts/register/$',register,{'form_class' : RegistrationFormCustom},name='registration_register'), - (r'^accounts/', include('registration.urls')), - (r'^accounts/profile/$', userViews.view_my_profile), - - (r'^user/view/uid=(\d+)$', userViews.view_my_profile), - (r'^user/edit/?$', userViews.edit_my_profile), - - (r'^user/requests/$', userViews.browse_requests), - (r'^user/requests/rid=(\d+)/$', userViews.view_request), - (r'^user/requests/rid=(\d+)/(\w+)/$', userViews.process_request), - - (r'^user/notifications/$', userViews.browse_notifications), - (r'^user/notifications/nid=(\d+)/$', userViews.view_notification), - (r'^user/notifications/nid=(\d+)/(\w+)/$', userViews.edit_notification), - (r'^user/make/(\w+)/$', userViews.change_rights), - - (r'^about/(\w+)/$', userViews.learn_more), - - (r'^textbook/$', taskViews.show_textbooks), - -) from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: