# HG changeset patch
# User nishanth
# Date 1265305230 -19800
# Node ID 36d3173ab7f9cce61eea56d28bf7468ae63ea3c3
# Parent c28774fe7ffd926c1f2ee01dd6657243e73fdf8a
addded link to view claims in 'view task' page .
diff -r c28774fe7ffd -r 36d3173ab7f9 taskapp/admin.py
--- a/taskapp/admin.py Thu Feb 04 22:37:15 2010 +0530
+++ b/taskapp/admin.py Thu Feb 04 23:10:30 2010 +0530
@@ -1,8 +1,9 @@
from django.contrib import admin
-from pytask.taskapp.models import Profile, Task, Credit, Comment
+from pytask.taskapp.models import Profile, Task, Credit, Comment, Claim
admin.site.register(Profile)
admin.site.register(Task)
admin.site.register(Comment)
admin.site.register(Credit)
+admin.site.register(Claim)
diff -r c28774fe7ffd -r 36d3173ab7f9 taskapp/forms/task.py
--- a/taskapp/forms/task.py Thu Feb 04 22:37:15 2010 +0530
+++ b/taskapp/forms/task.py Thu Feb 04 23:10:30 2010 +0530
@@ -1,5 +1,5 @@
from django import forms
-from pytask.taskapp.models import Task
+from pytask.taskapp.models import Task, Claim
class TaskCreateForm(forms.ModelForm):
class Meta:
@@ -15,7 +15,7 @@
form = myform(instance=instance) if instance else myform()
return form
-def ClaimTaskForm(models.ModelForm):
+class ClaimTaskForm(forms.ModelForm):
class Meta:
model = Claim
fields = ['message']
diff -r c28774fe7ffd -r 36d3173ab7f9 taskapp/models.py
--- a/taskapp/models.py Thu Feb 04 22:37:15 2010 +0530
+++ b/taskapp/models.py Thu Feb 04 23:10:30 2010 +0530
@@ -14,7 +14,7 @@
("LO", "Locked"),
("CL", "Claimed"),
("AS", "Assigned"),
- ("RO", "Reopened"),
+ ("RE", "Reopened"),
("CD", "Closed"),
("DL", "Deleted"),
("CM", "Completed"))
diff -r c28774fe7ffd -r 36d3173ab7f9 taskapp/views/task.py
--- a/taskapp/views/task.py Thu Feb 04 22:37:15 2010 +0530
+++ b/taskapp/views/task.py Thu Feb 04 23:10:30 2010 +0530
@@ -3,7 +3,7 @@
from django.http import HttpResponse
from django.shortcuts import render_to_response, redirect
-from pytask.taskapp.models import User, Task, Comment
+from pytask.taskapp.models import User, Task, Comment, Claim
from pytask.taskapp.forms.task import TaskCreateForm, AddMentorForm
from pytask.taskapp.events.task import createTask, addMentor, publishTask, addSubTask
from pytask.taskapp.views.user import show_msg
@@ -38,12 +38,16 @@
is_guest = True if not user.is_authenticated() else False
is_mentor = True if user in task.mentors.all() else False
+ task_claimable = True if task.status in ["OP", "RE"] else False
+ user_can_view_claim = True if ( task_claimable and not ( is_guest or is_mentor ) ) else False
+
context = {'user':user,
'task':task,
'comments':comments,
'mentors':mentors,
'is_guest':is_guest,
'is_mentor':is_mentor,
+ 'user_can_view_claim':user_can_view_claim,
'errors':errors,
}
@@ -171,10 +175,22 @@
user = request.user
task = Task.objects.get(id=tid)
+ claims = Claim.objects.filter(task=task)
+
+ is_guest = True if not user.is_authenticated() else False
+
+ task_claimable = True if task.status in ["OP", "RE"] else False
+ user_can_claim = True if ( task_claimable and not ( is_guest or is_mentor ) and ( user not in task.claimed_users.all() ) ) else False
+
+ if not is_guest:
+ if task_claimable:
+ pass
+ else:
+ return show_msg('You are not logged in to view claims for this task', task_url, 'view the task')
+ else:
+ return show_msg('You are not logged in to view claims for this task', task_url, 'view the task')
-
-
diff -r c28774fe7ffd -r 36d3173ab7f9 templates/task/view.html
--- a/templates/task/view.html Thu Feb 04 22:37:15 2010 +0530
+++ b/templates/task/view.html Thu Feb 04 23:10:30 2010 +0530
@@ -20,7 +20,11 @@
{{ task.desc }}