def minmax(field):
    """
    Process minimum and maximum parameters.
    """
    def outer(fn):
        def inner(request, **kwargs):
            filters = {}
            try:
                if 'min' in request.GET:
                    filters['%s__gte' % field] = timestamp_to_datetime(int(request.GET['min']))
                if 'max' in request.GET:
                    filters['%s__lte' % field] = timestamp_to_datetime(int(request.GET['max']))
            except ValueError:
                raise APIException("Invalid min and/or max parameter specified.")
            return fn(request, **kwargs).filter(**filters)
        return inner
    return outer
dataset/ETHPy150Open 2buntu/2buntu-blog/twobuntu/api/v1_2/views.py/minmax/original