diff options
-rw-r--r-- | taskapp/forms/task.py | 2 | ||||
-rw-r--r-- | taskapp/views/task.py | 5 | ||||
-rw-r--r-- | templates/task/assigncredits.html | 4 |
3 files changed, 7 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) diff --git a/templates/task/assigncredits.html b/templates/task/assigncredits.html index 066505d..eff23bf 100644 --- a/templates/task/assigncredits.html +++ b/templates/task/assigncredits.html @@ -12,6 +12,8 @@ {% if prev_credits %} <a href="/task/complete/tid={{task.id}}">Mark task as complete.</a> <hr /> + {% endif %} + {% if credit_requests %} <br/>Previous credits:<br /> {% for req in credit_requests %} <hr /> @@ -34,5 +36,7 @@ status: Request pending {% endif %} {% endfor %} + {% else %} + No assigning of pynts has been made for this task. {% endif %} {% endblock %} |