# HG changeset patch
# User nishanth
# Date 1267398889 -19800
# Node ID 7cad1e92713d0e06ef235dcf0a6110becd8aa169
# Parent 52958289d81f8530d5c619c1c496fb1982cb4e42
finalised the view_task page.
diff -r 52958289d81f -r 7cad1e92713d taskapp/events/task.py
--- a/taskapp/events/task.py Mon Mar 01 02:09:00 2010 +0530
+++ b/taskapp/events/task.py Mon Mar 01 04:44:49 2010 +0530
@@ -27,8 +27,11 @@
task.comment_set.update(deleted_by=task.created_by)
task.published_datetime = datetime.now()
+ task.save()
- task.save()
+ pending_requests = task.request_task.filter(is_valid=True, is_replied=False)
+ pending_requests.update(is_valid=False)
+
return task
def addSubTask(main_task, sub_task):
@@ -233,12 +236,12 @@
## generate notifications here
for a_user in task.assigned_users.all():
- create_notification(role="CD", sent_to=a_user, sent_from=marked_by, task=task)
+ create_notification(role="CD", sent_to=a_user, sent_from=closed_by, task=task, remarks=reason)
for a_user in task.claimed_users.all():
- create_notification(role="CD", sent_to=a_user, sent_from=marked_by, task=task)
+ create_notification(role="CD", sent_to=a_user, sent_from=closed_by, task=task, remarks=reason)
for a_mentor in task.mentors.all():
- create_notification(role="CD", sent_to=a_mentor, sent_from=marked_by, task=task)
+ create_notification(role="CD", sent_to=a_mentor, sent_from=closed_by, task=task, remarks=reason)
diff -r 52958289d81f -r 7cad1e92713d taskapp/utilities/notification.py
--- a/taskapp/utilities/notification.py Mon Mar 01 02:09:00 2010 +0530
+++ b/taskapp/utilities/notification.py Mon Mar 01 04:44:49 2010 +0530
@@ -52,6 +52,9 @@
elif role == "MT":
+ notification.task = task
+ notification.sent_from = sent_from
+
task_url= '%s'%(task.id, task.title)
requested_mentor_url = '%s'%(requested_by.id, requested_by.username)
new_mentor = sent_from
@@ -70,6 +73,8 @@
elif role in ["DV", "MG", "AD"]:
+ notification.sent_from = sent_from
+
accepting_user = sent_from
user_url = '%s'%(accepting_user.id, accepting_user.username) ## i mean the user who has accepted it
requested_by_url = '%s'%(requested_by.id, requested_by.username)
@@ -88,6 +93,7 @@
elif role == "NT":
+ notification.task = task
new_mentor = sent_to
mentor_learn_url = 'learn more'
task_url= '%s'%(task.id, task.title)
@@ -110,6 +116,12 @@
notification.message += "Happy Mentoring."
elif role in ["CM", "CD"]:
+
+ notification.sent_from = sent_from
+ notification.role = role
+ notification.task = task
+ notification.remarks = remarks
+
mentor = sent_from
mentor_url = '%s'%(mentor.id, mentor.username)
task_url= '%s'%(task.id, task.title)
diff -r 52958289d81f -r 7cad1e92713d taskapp/views/task.py
--- a/taskapp/views/task.py Mon Mar 01 02:09:00 2010 +0530
+++ b/taskapp/views/task.py Mon Mar 01 04:44:49 2010 +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, Claim, Request
+from pytask.taskapp.models import User, Task, Comment, Claim, Request, Notification
from pytask.taskapp.utilities.task import getTask
from pytask.taskapp.forms.task import TaskCreateForm, AddMentorForm, AddTaskForm, ChoiceForm, AssignCreditForm, RemoveUserForm
from pytask.taskapp.events.task import createTask, reqMentor, publishTask, addSubTask, addDep, addClaim, assignTask, updateTask, removeTask, removeUser, assignCredits, completeTask, closeTask
@@ -80,15 +80,24 @@
'is_mentor':is_mentor,
}
+ context['task_viewable'] = True if ( task.status != "UP" ) or is_mentor else False
+
context['can_publish'] = True if task.status == "UP" and user == task.created_by else False
- context['task_viewable'] = True if ( task.status != "UP" ) or is_mentor else False
- context['task_claimable'] = True if task.status in ["OP", "WR"] else False
+ context['can_edit'] = True if task.status in ["UP", "LO", "OP"] and is_mentor else False
+ context['can_close'] = True if task.status not in ["UP", "CD", "CM"] and is_mentor else False
context['can_mod_mentors'] = True if task.status in ["UP", "OP", "LO", "WR"] and is_mentor else False
context['can_mod_tasks'] = True if task.status in ["UP", "OP", "LO"] and is_mentor else False
+
context['can_assign_credits'] = True if task.status in ["OP", "WR"] and is_mentor else False
-
- context['assigned_users'] = task.assigned_users.all()
+ context['task_claimable'] = True if task.status in ["OP", "WR"] and not is_guest else False
+
+ if task.status == "CD":
+ context['closing_notification'] = Notification.objects.filter(task=task,role="CD")[0]
+ elif task.status == "CM":
+ context['completed_notification'] = Notifications.objects.filter(task=task,role="CM")[0]
+ elif task.status == "WR":
+ context['assigned_users'] = task.assigned_users.all()
if request.method == 'POST':
if not is_guest:
@@ -182,6 +191,7 @@
context = {
'user':user,
+ 'task':task,
'pending_requests':pending_requests,
'form':form,
}
@@ -420,7 +430,7 @@
assignTask(task, assigned_user, user)
return redirect(task_url)
else:
- return render_to_response('task/assign.html',{'form':form})
+ return render_to_response('task/assign.html',{'user':user, 'task':task,'form':form})
elif assigned_users:
return show_msg(user, 'When the no of users you need for the task is more than the no of users willing to do the task, I\'d say please re consider the task :P',task_url, 'view the task')
else:
diff -r 52958289d81f -r 7cad1e92713d taskapp/views/user.py
--- a/taskapp/views/user.py Mon Mar 01 02:09:00 2010 +0530
+++ b/taskapp/views/user.py Mon Mar 01 04:44:49 2010 +0530
@@ -38,12 +38,7 @@
if not user.is_authenticated():
is_guest = True
disp_num = 10
- tasks_count = Task.objects.count()
- if tasks_count <= disp_num:
- task_list = Task.objects.order_by('id').reverse()
- else:
- task_list = Task.objects.order_by('id').reverse()[:10]
-
+ task_list = Task.objects.exclude(status="UP").order_by('published_datetime').reverse()[:10]
return render_to_response('index.html', {'user':user, 'is_guest':is_guest, 'task_list':task_list})
else:
diff -r 52958289d81f -r 7cad1e92713d templates/task/assign.html
--- a/templates/task/assign.html Mon Mar 01 02:09:00 2010 +0530
+++ b/templates/task/assign.html Mon Mar 01 04:44:49 2010 +0530
@@ -1,5 +1,6 @@
{% extends 'base.html' %}
{% block content %}
+ click here to return to the claims page.
Select a user to assign this task.