# HG changeset patch # User Nishanth Amuluru # Date 1294554717 -19800 # Node ID 070f01dd7d8e88daac93cd716ba7882e0facf163 # Parent 41a7d8d49e35836f233f760d01575834104e96ad Select user works completely fine diff -r 41a7d8d49e35 -r 070f01dd7d8e pytask/taskapp/urls.py --- a/pytask/taskapp/urls.py Sun Jan 09 11:52:30 2011 +0530 +++ b/pytask/taskapp/urls.py Sun Jan 09 12:01:57 2011 +0530 @@ -1,6 +1,6 @@ from django.conf.urls.defaults import * -from pytask.taskapp.views import create_task, view_task, claim_task \ +from pytask.taskapp.views import create_task, view_task, claim_task, \ select_user urlpatterns = patterns('', @@ -8,5 +8,6 @@ (r'^create/$', create_task), (r'^view/tid=(\w+)', view_task), (r'^claim/tid=(\w+)', claim_task), + (r'^select/tid=(\w+)', select_user), ) diff -r 41a7d8d49e35 -r 070f01dd7d8e pytask/taskapp/views.py --- a/pytask/taskapp/views.py Sun Jan 09 11:52:30 2011 +0530 +++ b/pytask/taskapp/views.py Sun Jan 09 12:01:57 2011 +0530 @@ -1,5 +1,7 @@ from datetime import datetime +from django.contrib.auth.models import User + from django.shortcuts import render_to_response, redirect from django.http import Http404 @@ -11,7 +13,9 @@ from pytask.views import show_msg from pytask.taskapp.models import Task, TaskComment, TaskClaim -from pytask.taskapp.forms import CreateTaskForm, EditTaskForm, TaskCommentForm, ClaimTaskForm +from pytask.taskapp.forms import CreateTaskForm, EditTaskForm, \ + TaskCommentForm, ClaimTaskForm, \ + ChoiceForm from pytask.taskapp.utils import getTask from pytask.profile.utils import get_notification @@ -220,16 +224,16 @@ context.update(csrf(request)) - task_claimed = True if claimed_users else False claimed_users = task.claimed_users.all() selected_users = task.selected_users.all() + task_claimed = True if claimed_users else False is_creator = True if user == task.created_by else False if ( is_creator or profile.rights in ["CR", "DC"] ) and \ - task.status in ["OP", "WR"] and task_claimed: + task.status in ["OP", "WR"]: - if claimed_users: + if task_claimed: user_list = ((user.id,user.username) for user in claimed_users) @@ -239,8 +243,8 @@ uid = form.cleaned_data['choice'] selected_user = User.objects.get(id=uid) - task.selected_users.add(user) - task.claimed_users.remove(user) + task.selected_users.add(selected_user) + task.claimed_users.remove(selected_user) task.save() return redirect(task_url) diff -r 41a7d8d49e35 -r 070f01dd7d8e pytask/templates/task/claim.html --- a/pytask/templates/task/claim.html Sun Jan 09 11:52:30 2011 +0530 +++ b/pytask/templates/task/claim.html Sun Jan 09 12:01:57 2011 +0530 @@ -23,7 +23,7 @@ {% endif %} {% if old_claims and is_creator %}
- Select a user to assign the work + Select a user to assign the work {% endif %} {% if can_claim %} diff -r 41a7d8d49e35 -r 070f01dd7d8e pytask/templates/task/select_user.html --- a/pytask/templates/task/select_user.html Sun Jan 09 11:52:30 2011 +0530 +++ b/pytask/templates/task/select_user.html Sun Jan 09 12:01:57 2011 +0530 @@ -3,6 +3,7 @@ click here to return to the claims page.

Select a user to assign this task.
+ {% csrf_token %} {{form.as_table}}