# HG changeset patch # User nishanth # Date 1267007911 -19800 # Node ID 9fc60a22101679e53e5921710e2e404e51b81da3 # Parent a14ec2f09beb9168e9089f93edc1d38ff0d6ede2 modified claim_task view to suit the new design diff -r a14ec2f09beb -r 9fc60a221016 taskapp/views/task.py --- a/taskapp/views/task.py Wed Feb 24 15:10:03 2010 +0530 +++ b/taskapp/views/task.py Wed Feb 24 16:08:31 2010 +0530 @@ -193,18 +193,19 @@ user = request.user task = getTask(tid) claims = Claim.objects.filter(task=task) + + mentors = task.mentors.all() + claimed_users = task.claimed_users.all() is_guest = True if not user.is_authenticated() else False - if user in task.mentors.all(): - is_mentor = True - else: - is_mentor = False + is_mentor = True if user in mentors else False - task_claimable = True if task.status in ["OP", "RE", "CL"] 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 - task_claimed = True if task.status == "CL" else False + task_claimable = True if task.status in ["OP", "WR"] else False + user_can_claim = True if task_claimable and not ( is_guest or is_mentor ) and ( user not in claimed_users ) else False + task_claimed = True if claimed_users else False - context = {'is_mentor':is_mentor, + context = {'user':user, + 'is_mentor':is_mentor, 'task':task, 'claims':claims, 'user_can_claim':user_can_claim, @@ -268,4 +269,4 @@ and then give the user fields accordingly. """ - return None + task = Task.objects.get(id=tid) diff -r a14ec2f09beb -r 9fc60a221016 templates/task/claim.html --- a/templates/task/claim.html Wed Feb 24 15:10:03 2010 +0530 +++ b/templates/task/claim.html Wed Feb 24 16:08:31 2010 +0530 @@ -8,11 +8,15 @@ {{claim.message}}
{% endfor %} {% else %} - There are no claims for this task yet.
+ {% if task_claimable%} + There are no claims for this task yet.
+ {% else %} + This task cannot be claimed right now. + {% endif %} Click here to return to the task. {% endif %} {% if task_claimed and is_mentor %} - Assign task + Select a user to assign the work. {% endif %} {% if user_can_claim %}
diff -r a14ec2f09beb -r 9fc60a221016 templates/task/view.html --- a/templates/task/view.html Wed Feb 24 15:10:03 2010 +0530 +++ b/templates/task/view.html Wed Feb 24 16:08:31 2010 +0530 @@ -17,7 +17,7 @@ edit task goes here and it should contain all those add subs and add deps depending on availability
{% endif %} - {% if deps %} + {% if deps %}
The task has following dependencies {% for dep in deps %} {{dep.title}}
@@ -27,9 +27,9 @@ remove an existing dependency {% endif %} {% else %} - {%if can_mod_tasks %} + {% if can_mod_tasks %} add a subtask/dependency - {%endif%} + {% endif %} {% endif %}
@@ -43,12 +43,15 @@ {% for user in assigned_users %} {{user.username}}| {% endfor %} + {% if is_mentor %} + Remove an existing user
+ {% endif %} {% endif %} - {%if can_assign_credits%} + {% if can_assign_credits %} Assign credits - {%endif%} - {% if not is_guest %} + {% endif %} + {% if not is_guest and task_claimable %} View claims
{% endif %}