def archive_day(request, year, month, day, queryset, date_field, allow_future=False, month_format='%b', day_format='%d', **kwargs):
    try:
        date = datetime.date(*time.strptime(year+month+day, '%Y'+month_format+day_format)[:3])
    except __HOLE__:
        raise Http404
    
    model = queryset.model
    now = datetime.datetime.now()
    
    if isinstance(model._meta.get_field(date_field), DateTimeField):
        lookup_kwargs = {'%s__range' % date_field: (datetime.datetime.combine(date, datetime.time.min), datetime.datetime.combine(date, datetime.time.max))}
    else:
        lookup_kwargs = {date_field: date}
    
    # Only bother to check current date if the date isn't in the past and future objects aren't requested.
    if date >= now.date() and not allow_future:
        lookup_kwargs['%s__lte' % date_field] = now
    queryset = queryset.filter(**lookup_kwargs).order_by('-' + date_field)
    
    return list_detail.object_list(request, queryset=queryset, **kwargs)
dataset/ETHPy150Open kylef-archive/lithium/lithium/views/date_based.py/archive_day