diff options
author | nishanth | 2010-02-28 16:09:42 +0530 |
---|---|---|
committer | nishanth | 2010-02-28 16:09:42 +0530 |
commit | f067d7c463a37160aa39e85df36787ed54cab9e2 (patch) | |
tree | b86cddc06d92a429fda6502381d83b4796428875 /taskapp | |
parent | 11fecdb92d1bb571f8a40629c08a4ddeda7779d0 (diff) | |
download | pytask-f067d7c463a37160aa39e85df36787ed54cab9e2.tar.gz pytask-f067d7c463a37160aa39e85df36787ed54cab9e2.tar.bz2 pytask-f067d7c463a37160aa39e85df36787ed54cab9e2.zip |
now accepting an admin request will make all pending AD MG DV reqs as inactive.
Diffstat (limited to 'taskapp')
-rw-r--r-- | taskapp/events/request.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/taskapp/events/request.py b/taskapp/events/request.py index 747626a..b74f678 100644 --- a/taskapp/events/request.py +++ b/taskapp/events/request.py @@ -107,6 +107,17 @@ def reply_to_request(request_obj, reply, replied_by): alerting_users = Profile.objects.filter(user__is_active=True).filter(rights="AD") 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 or AD 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") | active_requests.filter(role="AD") + 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) |