def index(request):
    top_all_time = _get_pickers()

    last_month = datetime.date.today() - datetime.timedelta(365/12)
    top_last_month = _get_pickers(fruits__created__gte=last_month).exclude(fruit_count=0)

    context = dict(
        top_all_time=top_all_time[:10],
        top_last_month=top_last_month[:4],
        pickers_count=FruitUser.objects.active().order_by().count(),
        fruit_count=Fruit.objects.valid().order_by().count(),
    )

    return render(request, 'pickers/index.html', context)
dataset/ETHPy150Open jsmesami/naovoce/src/user/views.py/index/original