(request, day)
return compute_stats(date)
Statistics about this website for the given day.
    Day-0 is the day of the first post.

    Parameters:
    day -- a day, given as a number of days from day-0 (the day of the first post).
Statistics about this website for the given day.
    Day-0 is the day of the first post.
Statistics about this website for the given day . Day - 0 is the day of the first post .
def daily_stats_on_day(request, day):
    """
    Statistics about this website for the given day.
    Day-0 is the day of the first post.

    Parameters:
    day -- a day, given as a number of days from day-0 (the day of the first post).
    """
    day_zero = cache.get('day_zero')

    first_post = Post.objects.order_by('creation_date').only('creation_date')

    if day_zero is None and not first_post:
        return False

    if day_zero is None:
        day_zero = first_post[0].creation_date
        cache.set('day_zero', day_zero, 60 * 60 * 24 * 7)  # Cache valid for a week.

    date = day_zero + timedelta(days=int(day))

    # We don't provide stats for today or the future.
    if not date or date.date() >= datetime.today().date():
        return {}

    return compute_stats(date)
def daily_stats_on_day ( request , day ) : day_zero = cache . get ( 'day_zero' ) first_post = Post . objects . order_by ( 'creation_date' ) . only ( 'creation_date' ) if day_zero is None and not first_post : return False if day_zero is None : day_zero = first_post [ 0 ] . creation_date cache . set ( 'day_zero' , day_zero , 60 * 60 * 24 * 7 ) # Cache valid for a week. date = day_zero + timedelta ( days = int ( day ) ) # We don't provide stats for today or the future. if not date or date . date ( ) >= datetime . today ( ) . date ( ) : return { } return compute_stats ( date )