def prep_search_value(self, term, lookup_type):
        if lookup_type in ('exact', 'in', 'range'):
            try:
                date_obj = dateutil.parser.parse(term)
            except ValueError:
                # This exception is theoretical, but it doesn't seem to raise.
                pass
            except TypeError:
                # Failed conversions can lead to the parser adding ints to None.
                pass
            else:
                return date_obj

        if lookup_type not in ('exact', 'in', 'range'):
            test_term = term
            if lookup_type == 'week_day':
                try:
                    test_term = int(test_term) - 1  # Django ORM uses 1-7, python strptime uses 0-6
                except:
                    return None
                else:
                    test_term = str(test_term)

            for test_format in STRPTIME_PLACEHOLDERS[lookup_type]:
                # Try to validate the term against the given date lookup type
                try:
                    date_obj = datetime.strptime(test_term, test_format)
                except ValueError:
                    pass
                else:
                    if lookup_type == 'week_day':
                        term = date_obj.weekday() + 1  # Django ORM uses 1-7, python strptime uses 0-6
                    else:
                        term = getattr(date_obj, lookup_type)
                    return str(term)

        return super(DateColumn, self).prep_search_value(term, lookup_type)
dataset/ETHPy150Open pivotal-energy-solutions/django-datatable-view/datatableview/columns.py/DateColumn.prep_search_value/original