def get_from_timerange(self, qs, time_from): _seconds = parseTimeOffset(qs['from']) if 'from' in qs else timedelta(hours=-24) if time_from: extra_delta = parseTimeOffset(time_from) _seconds += extra_delta qs['from'] = '%dseconds' % _seconds.total_seconds() return "{range} ago".format(range=seconds_to_other(-int(_seconds.total_seconds())))
def get_from_timerange(self, qs, time_from): _seconds = parseTimeOffset(qs['from']) if 'from' in qs else timedelta( hours=-24) if time_from: extra_delta = parseTimeOffset(time_from) _seconds += extra_delta qs['from'] = '%dseconds' % _seconds.total_seconds() return "{range} ago".format( range=seconds_to_other(-int(_seconds.total_seconds())))
def get_to_timerange(self, qs, time_until): _seconds = parseTimeOffset(qs['until'] if 'until' in qs else timedelta(seconds=0)) if time_until: extra_delta = parseTimeOffset(time_until) _seconds += extra_delta qs['until'] = '%dseconds' % _seconds.total_seconds() title_to = seconds_to_other(-int(_seconds.total_seconds())) if int(_seconds.total_seconds()) == 0: del qs['until'] title_to = "now" return title_to
def get_to_timerange(self, qs, time_until): _seconds = parseTimeOffset(qs['until'] if 'until' in qs else timedelta( seconds=0)) if time_until: extra_delta = parseTimeOffset(time_until) _seconds += extra_delta qs['until'] = '%dseconds' % _seconds.total_seconds() title_to = seconds_to_other(-int(_seconds.total_seconds())) if int(_seconds.total_seconds()) == 0: del qs['until'] title_to = "now" return title_to