# HG changeset patch
# User nishanth
# Date 1267352987 -19800
# Node ID 0c97a02b9bdbec97fb9fa820dcbb00be265eb1a2
# Parent 581ad20b8c3943d13607e96d77acecf54a916f0d
now accepting to be a MG deleted pending DV and MG reqs.
diff -r 581ad20b8c39 -r 0c97a02b9bdb taskapp/events/request.py
--- a/taskapp/events/request.py Sun Feb 28 14:58:11 2010 +0530
+++ b/taskapp/events/request.py Sun Feb 28 15:59:47 2010 +0530
@@ -64,6 +64,16 @@
## drop a welcome message to that fucker
changeRole(role=request_obj.role, user=request_obj.replied_by)
create_notification(request_obj.role, request_obj.sent_by, request_obj.replied_by, reply, requested_by=request_obj.sent_by)
+
+ ## here we look for requests that are similar => requesting for DV and make them invalid
+ ## also we drop a notification to user who made request
+ pending_requests = request_obj.replied_by.request_sent_to.filter(is_valid=True,is_replied=False,role="DV")
+ for req in pending_requests:
+ req.is_valid = False
+ req.save()
+ create_notification(role = req.role, sent_to = req.sent_by, sent_from = replied_by, reply = False, \
+ remarks = "User has accepted a similar request and has rights same or higher privileged than the request", \
+ requested_by = req.sent_by )
else:
create_notification(request_obj.role, request_obj.sent_by, request_obj.replied_by, reply, remarks=request_obj.remarks, requested_by=request_obj.sent_by)
@@ -75,6 +85,17 @@
alerting_users = Profile.objects.filter(user__is_active=True).exclude(rights="CT").exclude(rights="DV")
for a_profile in alerting_users:
create_notification(request_obj.role, a_profile.user, request_obj.replied_by, reply, requested_by=request_obj.sent_by)
+
+ ## here we look for requests that less or similar => requesting for DV or MG and make them invalid
+ ## also we drop a notification to user who made request
+ active_requests = request_obj.replied_by.request_sent_to.filter(is_valid=True,is_replied=False)
+ pending_requests = active_requests.filter(role="DV") | active_requests.filter(role="MG")
+ for req in pending_requests:
+ req.is_valid = False
+ req.save()
+ create_notification(role = req.role, sent_to = req.sent_by, sent_from = replied_by, reply = False, \
+ remarks = "User has accepted a similar request and has rights same or higher privileged than the request", \
+ requested_by = req.sent_by )
else:
create_notification(request_obj.role, request_obj.sent_by, request_obj.replied_by, reply, remarks=request_obj.remarks, requested_by=request_obj.sent_by)
diff -r 581ad20b8c39 -r 0c97a02b9bdb taskapp/utilities/notification.py
--- a/taskapp/utilities/notification.py Sun Feb 28 14:58:11 2010 +0530
+++ b/taskapp/utilities/notification.py Sun Feb 28 15:59:47 2010 +0530
@@ -82,7 +82,7 @@
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 a %s.
"%(new_mentor_url, task_url)
+ notification.message = "%s has rejected your request asking him to act as a %s.
"%(user_url, role_rights)
if remarks:
notification.message += "Remarks: %s
"%remarks
diff -r 581ad20b8c39 -r 0c97a02b9bdb taskapp/views/user.py
--- a/taskapp/views/user.py Sun Feb 28 14:58:11 2010 +0530
+++ b/taskapp/views/user.py Sun Feb 28 15:59:47 2010 +0530
@@ -279,7 +279,7 @@
user_profile = user.get_profile()
user_rights = user_profile.rights
- user_can_view = True if user_rights == "AD" or ( user_rights == "MG" and role in ["mg", "dv"] ) else False
+ user_can_view = True if user_rights == "AD" or ( user_rights == "MG" and role in ["MG", "DV"] ) else False
if user_can_view:
if role == "DV":
diff -r 581ad20b8c39 -r 0c97a02b9bdb templates/index.html
--- a/templates/index.html Sun Feb 28 14:58:11 2010 +0530
+++ b/templates/index.html Sun Feb 28 15:59:47 2010 +0530
@@ -69,11 +69,11 @@
Create a task
{% endif %}
{% ifequal user.get_profile.rights "MG" %}
- Request another to be a Developer
+ Request another user to be a Developer
Request another user to act as manager
{% endifequal %}
{% ifequal user.get_profile.rights "AD" %}
- Request another to be a Developer
+ Request another user to be a Developer
Request another user to act as a Manager
Request another user to act as an Admin
{% endifequal %}