示例#1
0
def get_date_less_query(days, date_field):
    """ Query for if date_field is within number of "days" from now """

    query = None
    days = get_integer(days)
    if days:
        future = get_days_from_now(days)
        query = Q(**{"%s__lte" % date_field: future.isoformat()})
    return query
示例#2
0
def get_date_greater_query(days, date_field):
    """ Query for if date_field is within number of "days" ago """

    query = None
    days = get_integer(days)
    if days:
        past = get_days_ago(days)
        query = Q(**{"%s__gte" % date_field: past.isoformat()})
    return query