assign_credits event now creates a proper request object .
authornishanth
Thu, 25 Feb 2010 17:56:42 +0530
changeset 99 64c34c1f441f
parent 98 cf94e35a9f99
child 100 2275886511df
assign_credits event now creates a proper request object .
taskapp/events/task.py
taskapp/utilities/request.py
--- a/taskapp/events/task.py	Thu Feb 25 17:37:14 2010 +0530
+++ b/taskapp/events/task.py	Thu Feb 25 17:56:42 2010 +0530
@@ -1,5 +1,6 @@
 from datetime import datetime
 from pytask.taskapp.models import Profile, Task, Comment, Credit, Claim, Map
+from pytask.taskapp.utilities.request import create_request
 
 def publishTask(task):
     """ set the task status to open """
@@ -194,7 +195,7 @@
     """ make a proper request object.
     """
     
-    addCredits(task, given_by, given_to, points)
+    create_request(sent_by=given_by, role="PY", task=task, receiving_user=given_to, pynts=points ) 
 
 def addCredits(task, given_by, given_to, points):
     """ add credit to the credits model.
--- a/taskapp/utilities/request.py	Thu Feb 25 17:37:14 2010 +0530
+++ b/taskapp/utilities/request.py	Thu Feb 25 17:56:42 2010 +0530
@@ -22,7 +22,7 @@
     req.save()
     if role == 'PY':
         admin_profiles = Profile.objects.filter(rights='AD')
-        for admin in admin_profiles:
+        for admin_profile in admin_profiles:
             req.sent_to.add(admin_profile.user)
         req.receiving_user = receiving_user
     else: