diff -r 85276c5aee5c -r ca88bf4ad362 taskapp/utilities/notification.py --- a/taskapp/utilities/notification.py Sat Feb 27 17:20:22 2010 +0530 +++ b/taskapp/utilities/notification.py Sat Feb 27 19:21:15 2010 +0530 @@ -1,6 +1,6 @@ from datetime import datetime from django.contrib.auth.models import User -from pytask.taskapp.models import Notification +from pytask.taskapp.models import Notification, RIGHTS_CHOICES def create_notification(role, sent_to, sent_from=None, reply=None, task=None, remarks=None, requested_by=None, receiving_user=None, pynts=None): """ @@ -68,6 +68,23 @@ if remarks: notification.message += "Remarks: %s
"%remarks + elif role in ["DV", "MG", "AD"]: + + accepting_user = sent_from + user_url = '%s'%(accepting_user.id,accepting_user.username) ## i mean the user who has accepted it + requested_by_url = '%s'%(requested_by.id,requested_by.username) + role_rights = dict(RIGHTS_CHOICES)[role] + role_learn_url = "/about/%s"%role_rights.lower() + a_or_an = "an" if role == "AD" else "a" + + if reply: + notification.sub = "New %s for the site"%role_rights + notification.message = "%s has accepted request made by %s asking him to act as %s %s for the website.
"%(user_url, requested_by_url, a_or_an, role_rights) + else: + notification.sub = "Rejected your request to act as %s"%role_rights + notification.message = "%s has rejected your request asking him to act as %s %s for the website.
"%(user_url, a_or_an, role_rights) + if remarks: + notification.message += "Remarks: %s
"%remarks elif role == "NT":