def item(request, item_slug, id): try: item = get_object_or_404(Item, id=id, slug=item_slug) ItemViewsStat.inc(item) except Exception, e: logger.debug(e) raise
def update(item, v, days): for x in range(days): date = (datetime.now() - timedelta(x)).date() ItemViewsStat.inc(item, date, v)