taskapp/utilities/notification.py
changeset 161 74ef330c9185
parent 156 7cad1e92713d
child 162 d378eff02f2e
equal deleted inserted replaced
160:05157d35d66f 161:74ef330c9185
   113             for a_user in working_users:
   113             for a_user in working_users:
   114                 notification.message += "<li> %s - %s </li>"%(a_user.username, a_user.email)
   114                 notification.message += "<li> %s - %s </li>"%(a_user.username, a_user.email)
   115             notification.message += "</ul><br />"
   115             notification.message += "</ul><br />"
   116         notification.message += "Happy Mentoring."
   116         notification.message += "Happy Mentoring."
   117 
   117 
       
   118     elif role == "NU":
       
   119 
       
   120         start_here_url = '<a href="/about/starthere/" taget="_blank">start here</a>'
       
   121         notification.sub = "Welcome %s"%sent_to.username
       
   122         notification.message = "Welcome to PyTasks %s.<br />"%sent_to.username
       
   123         notification.message += "If you are lost and have no clue, %s"%start_here_url
       
   124 
       
   125     elif role in ["ND", "NG", "NA"]:
       
   126 
       
   127         rights_dict = dict(RIGHTS_CHOICES)
       
   128 
       
   129         if role == "ND":
       
   130             role_rights = rights_dict["DV"]
       
   131         elif role == "NG":
       
   132             role_rights = rights_dict["MG"]
       
   133         elif role == "NA":
       
   134             role_rights = rights_dict["AD"]
       
   135 
       
   136         requested_by_url = r'<a href="/user/view/uid=%s">%s</a>'%(requested_by.id, requested_by.username)
       
   137         role_learn_url = r'<a href="/about/%s" target="_blank">click here</a>'%role_rights.lower()
       
   138         a_or_an = "an" if role_rights == "Admin" else "a"
       
   139 
       
   140         notification.sub = "You are now %s %s"%(a_or_an, role_rights)
       
   141         notification.message = r"You have accepted the request made by %s asking you to act as %s %s in the site "%(requested_by_url, a_or_an, role_rights)
       
   142         notification.message += "and you are now %s %s in the site.<br /> %s to learn more on %s."%(a_or_an, role_rights, role_learn_url, role_rights)
       
   143 
       
   144 
   118     elif role in ["CM", "CD"]:
   145     elif role in ["CM", "CD"]:
   119 
   146 
   120         notification.sent_from = sent_from
   147         notification.sent_from = sent_from
   121         notification.role = role
   148         notification.role = role
   122         notification.task = task
   149         notification.task = task