now accepting to be a MG deleted pending DV and MG reqs.
--- 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)
--- 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.<br />"%(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.<br />"%(new_mentor_url, task_url)
+ notification.message = "%s has rejected your request asking him to act as a %s.<br />"%(user_url, role_rights)
if remarks:
notification.message += "Remarks: %s<br />"%remarks
--- 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":
--- 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 @@
<a href="/task/create/">Create a task</a><br />
{% endif %}
{% ifequal user.get_profile.rights "MG" %}
- <a href="/user/make/dv/">Request another to be a Developer</a>
+ <a href="/user/make/dv/">Request another user to be a Developer</a><br />
<a href="/user/make/mg/">Request another user to act as manager</a><br />
{% endifequal %}
{% ifequal user.get_profile.rights "AD" %}
- <a href="/user/make/dv/">Request another to be a Developer</a><br />
+ <a href="/user/make/dv/">Request another user to be a Developer</a><br /><br />
<a href="/user/make/mg/">Request another user to act as a Manager</a><br />
<a href="/user/make/ad">Request another user to act as an Admin</a><br />
{% endifequal %}