created form and created basic template for work report
authorNishanth Amuluru <nishanth@fossee.in>
Thu, 06 Jan 2011 00:15:17 +0530
changeset 221 a3de0d3c60a3
parent 220 807e4b701a20
child 222 eeef395a4e02
created form and created basic template for work report
taskapp/views/task.py
templates/task/report.html
urls.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)
 
 
--- 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}} <br />
+{% endfor %}
+{% endif %}
+some data
+<hr />
 {% endblock %}
--- 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<path>.*)$', '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: