(field_name, gt=None, gte=None, lt=None, lte=None)
return {
        f"{field_name}__{param}": _adjust_lte_date(param, value)
        for param, value in params.items()
        if value is not None
    }
Return a dictionary mapping Django field filter names to filter values.

    filters = django_date_filter("created_on", gt=d1, lte=d2)
    Model.objects.filter(**filters)
Return a dictionary mapping Django field filter names to filter values.
Return a dictionary mapping Django field filter names to filter values .
def django_date_filter(field_name, gt=None, gte=None, lt=None, lte=None):
    """Return a dictionary mapping Django field filter names to filter values.

    filters = django_date_filter("created_on", gt=d1, lte=d2)
    Model.objects.filter(**filters)
    """
    params = dict(zip(['gt', 'gte', 'lt', 'lte'], [gt, gte, lt, lte]))

    def _adjust_lte_date(param, value):
        """Adjust `lte` when value is date (not datetime) so that it is inclusive of all data
        in the day.
        """
        if param != 'lte' or isinstance(value, datetime.datetime):
            return value

        return datetime.datetime.combine(value, datetime.datetime.max.time())

    return {
        f"{field_name}__{param}": _adjust_lte_date(param, value)
        for param, value in params.items()
        if value is not None
    }
def django_date_filter ( field_name , gt = None , gte = None , lt = None , lte = None ) : params = dict ( zip ( [ 'gt' , 'gte' , 'lt' , 'lte' ] , [ gt , gte , lt , lte ] ) ) def _adjust_lte_date ( param , value ) : """Adjust `lte` when value is date (not datetime) so that it is inclusive of all data
        in the day.
        """ if param != 'lte' or isinstance ( value , datetime . datetime ) : return value return datetime . datetime . combine ( value , datetime . datetime . max . time ( ) ) return { f"{field_name}__{param}" : _adjust_lte_date ( param , value ) for param , value in params . items ( ) if value is not None }