예제 #1
0
파일: query.py 프로젝트: gajanp/djangoware
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
파일: query.py 프로젝트: gajanp/djangoware
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