#NEWLINE# def filingTimeFilter( queryset , querydict ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# time_range = time_range [ 'time_range' ] #NEWLINE# if ( time_range == 'day' ) : #NEWLINE# #INDENT# today = date . today ( ) #NEWLINE# queryset = queryset . filter ( filed_date = today ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( time_range == 'week' ) : #NEWLINE# #INDENT# today = date . today ( ) #NEWLINE# one_week_ago = ( today - timedelta ( days = 7 ) ) #NEWLINE# queryset = queryset . filter ( filed_date__gte = one_week_ago ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( time_range == '2014_cycle' ) : #NEWLINE# #INDENT# queryset = queryset . filter ( filed_date__gte = date ( 2013 , 1 , 1 ) , filed_date__lte = date ( 2014 , 12 , 31 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( time_range == '2016_cycle' ) : #NEWLINE# #INDENT# queryset = queryset . filter ( filed_date__gte = date ( 2015 , 1 , 1 ) , filed_date__lte = date ( 2016 , 12 , 31 ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# return queryset