def flag_summary_page(request): page_url = "/admin/flagged" try: # Check to see if we're coming here from a GET. If so, we've got work to do. if request.method == 'GET': # Pull the relevant variables from the request string. length = request.GET.get('length', None) tab = request.GET.get('tab', None) # Persist the specified variables in the session for when the user navigates away and back. # Otherwise, pull the information out of the session if (length): request.session['flag-length'] = length else: length = request.session.get('length', '1') if (tab): request.session['flag-tab'] = tab else: tab = request.session.get('flag-tab', 'reckoning') # Execute the correct action based on the selected tab and info. Valid tabs: # * 'comment', 'reckoning' (default) if (tab == "comment"): flaggedAfter = getCurrentDateTime() - timedelta(days=int(length)) reckoning_response = client_get_flagged_reckoning_comments(flagged_after=flaggedAfter, page=None, size=None, session_id=request.user.session_id) else: tab = 'reckoning' flaggedAfter = getCurrentDateTime() - timedelta(days=int(length)) reckoning_response = client_get_flagged_reckonings(flagged_after=flaggedAfter, page=None, size=None, session_id=request.user.session_id) if not reckoning_response.status.success: logger.error("Flag called failed: " + reckoning_response.status.message) context = {'reckonings' : reckoning_response.reckonings, 'length' : int(length), 'tab' : tab, 'page_url' : page_url} c = RequestContext(request, context) return render_to_response('flag_summary.html', c) except Exception: logger.error("Exception when showing the Closed Reckonings list:") logger.error(traceback.print_exc(8)) raise Exception
def until_time(value): ''' Creates a display string to show the time until the specified date. ''' if (value): timeDelta = getTimeDelta(getCurrentDateTime(), value) return timeDeltaFormatter(timeDelta) return ""
def time_since(value): ''' Creates a display string to show the time since the specified date. ''' if (value): timeDelta = getTimeDelta(value, getCurrentDateTime()) return timeDeltaFormatter(timeDelta) return ""