diff options
author | nishanth | 2010-02-28 03:01:53 +0530 |
---|---|---|
committer | nishanth | 2010-02-28 03:01:53 +0530 |
commit | eb93427d1f7b439258e6d2bd1c89afbd52d34ea2 (patch) | |
tree | 27ccb4292439fc3a24e896efe505cd798e376982 /taskapp | |
parent | af7842ffd0effddd2d2438f4ac30eeb5d682bf38 (diff) | |
download | pytask-eb93427d1f7b439258e6d2bd1c89afbd52d34ea2.tar.gz pytask-eb93427d1f7b439258e6d2bd1c89afbd52d34ea2.tar.bz2 pytask-eb93427d1f7b439258e6d2bd1c89afbd52d34ea2.zip |
deducing previous credits for a task using the request model. with a few changes, we can ditchax the credits model.
Diffstat (limited to 'taskapp')
-rw-r--r-- | taskapp/forms/task.py | 2 | ||||
-rw-r--r-- | taskapp/views/task.py | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/taskapp/forms/task.py b/taskapp/forms/task.py index 24749e0..f3655bf 100644 --- a/taskapp/forms/task.py +++ b/taskapp/forms/task.py @@ -46,7 +46,7 @@ def AssignCreditForm(choices, instance=None): class myForm(forms.Form): user = forms.ChoiceField(choices=choices, required=True) - points = forms.IntegerField(min_value=0,required=True) + pynts = forms.IntegerField(min_value=0, required=True, help_text="Choose wisely since it cannot be undone.") return myForm(instance) if instance else myForm() def RemoveUserForm(choices, instance=None): diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 26aca14..0115ca9 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -433,8 +433,7 @@ def assign_credits(request, tid): choices = [(_.id,_.username) for _ in task.mentors.all()] if task.status == "WR": choices.extend([(_.id, _.username) for _ in task.assigned_users.all() ]) - prev_credits = task.credit_set.all() - ## here we can ditchax credits model and use the request model + prev_credits = task.request_task.filter(role="PY",is_valid=True,is_replied=True,reply=True).count() credit_requests = task.request_task.filter(role="PY",is_valid=True).order_by('creation_date').reverse() form = AssignCreditForm(choices) @@ -452,7 +451,7 @@ def assign_credits(request, tid): if form.is_valid(): data = form.cleaned_data uid = data['user'] - points = data['points'] + points = data['pynts'] given_to = User.objects.get(id=uid) assignCredits(task=task, given_by=user, given_to=given_to, points=points) return redirect('/task/assigncredits/tid=%s'%task.id) |