def request_decline(request, id): notifObject = Notification.objects.get(id = id) notifObject = notifUtil.respondToNotif(notifObject, "Deny") actionObject = notifUtil.getNotifSourceObject(notifObject) requesterProfile = actionObject.requester context = {} context['requesterName'] = requesterProfile.user.username if actionUtil.isShedRequest(actionObject): shedObject = actionObject.shed shedName = shedObject.name context['objectName'] = shedName context['type'] = "Shed" elif actionUtil.isToolRequest(actionObject): toolObject = actionObject.tool toolName = toolObject.name context['objectName'] = toolName context['type'] = "Tool" context.update(content.genBaseLoggedIn(request)) actionUtil.forceProcessActions() return render_to_response("view_notifs.html", content.addRequestDeniedNoti(context))
def request_decline(request, id): notifObject = Notification.objects.get(id=id) notifObject = notifUtil.respondToNotif(notifObject, "Deny") actionObject = notifUtil.getNotifSourceObject(notifObject) requesterProfile = actionObject.requester context = {} context['requesterName'] = requesterProfile.user.username if actionUtil.isShedRequest(actionObject): shedObject = actionObject.shed shedName = shedObject.name context['objectName'] = shedName context['type'] = "Shed" elif actionUtil.isToolRequest(actionObject): toolObject = actionObject.tool toolName = toolObject.name context['objectName'] = toolName context['type'] = "Tool" context.update(content.genBaseLoggedIn(request)) actionUtil.forceProcessActions() return render_to_response("view_notifs.html", content.addRequestDeniedNoti(context))
def test_getNotifSourceObject (self): """ """ print (notifUtils.getNotifSourceObject (self.genInfoNotif)) print (Tool.objects.get (name = "Hoe")) self.assertEqual (Tool.objects.get (name = "Hoe"), notifUtils.getNotifSourceObject (self.genInfoNotif))