def _trending_for_yesterday(metric=None):
    today = datetime.date.today()
    yesterday_date = today - datetime.timedelta(days=1)
    previous_week_date = today - datetime.timedelta(weeks=1)
    previous_month_date = get_previous_month(today)

    data = {
            'yesterday': 0,
            'previous_week': 0,
            'previous_month': 0,
    }

    try:
        yesterday = MetricDay.objects.get(metric=metric, created=yesterday_date)
        data['yesterday'] = yesterday.num
    except ObjectDoesNotExist:
        pass

    try: 
        previous_week = MetricDay.objects.get(metric=metric, created=previous_week_date)
        data['previous_week'] = previous_week.num
    except ObjectDoesNotExist:
        pass

    try:
        previous_month = MetricDay.objects.get(metric=metric, created=previous_month_date)
        data['previous_month'] = previous_month.num
    except ObjectDoesNotExist:
        pass

    return data
dataset/ETHPy150Open frankwiles/django-app-metrics/app_metrics/trending.py/_trending_for_yesterday/original