diff options
author | nishanth | 2010-02-04 23:10:30 +0530 |
---|---|---|
committer | nishanth | 2010-02-04 23:10:30 +0530 |
commit | fcd65993031a3c9ac9b9d1d42f26fed3f21a3f70 (patch) | |
tree | fb4b455382c00dbc68becb49bd12f2c017893b5b /taskapp/views/task.py | |
parent | 9dbedfce8120701cddfae38135c0ddd9dc57835c (diff) | |
download | pytask-fcd65993031a3c9ac9b9d1d42f26fed3f21a3f70.tar.gz pytask-fcd65993031a3c9ac9b9d1d42f26fed3f21a3f70.tar.bz2 pytask-fcd65993031a3c9ac9b9d1d42f26fed3f21a3f70.zip |
addded link to view claims in 'view task' page .
Diffstat (limited to 'taskapp/views/task.py')
-rw-r--r-- | taskapp/views/task.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 99c02d2..f08a82f 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -3,7 +3,7 @@ from datetime import datetime 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 @@ def view_task(request, tid): 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,8 +175,20 @@ def claim_task(request, tid): 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') |