Пример #1
0
 def get_filter_value(value, operation):
   """returns parsed datetime pairs for selected operation"""
   converted_pairs = date_parsers.parse_date(unicode(value))
   if not converted_pairs:
     return
   date_dict = {
       "=": converted_pairs,
       ">": (converted_pairs[1], None),
       "<": (None, converted_pairs[0]),
       ">=": (converted_pairs[0], None),
       "<=": (None, converted_pairs[1]),
   }
   return date_dict.get(operation)
Пример #2
0
 def get_filter_value(value, operation):
   """returns parsed datetime pairs for selected operation"""
   converted_pairs = date_parsers.parse_date(unicode(value))
   if not converted_pairs:
     return
   date_dict = {
       "=": converted_pairs,
       "~": converted_pairs,
       "!~": (converted_pairs[1], converted_pairs[0]),
       "!=": (converted_pairs[1], converted_pairs[0]),
       ">": (converted_pairs[1], None),
       "<": (None, converted_pairs[0]),
       ">=": (converted_pairs[0], None),
       "<=": (None, converted_pairs[1]),
   }
   return date_dict.get(operation)