当前位置: 首页>>代码示例>>Python>>正文


Python views.check_series_params_or_404函数代码示例

本文整理汇总了Python中stats.views.check_series_params_or_404函数的典型用法代码示例。如果您正苦于以下问题:Python check_series_params_or_404函数的具体用法?Python check_series_params_or_404怎么用?Python check_series_params_or_404使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_series_params_or_404函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: finance_line_series

def finance_line_series(request, addon, group, start, end, format, primary_field=None, inapp=None):
    """
    Date-based contribution series.
    primary_field -- revenue/count/refunds
    inapp -- inapp name, which shows stats for a certain inapp
    """
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon, for_contributions=True)

    if inapp:
        series = get_series_line(
            InappPayment,
            group,
            primary_field=primary_field,
            addon=addon.id,
            date__range=date_range,
            inapp=inapp.lower(),
        )
    else:
        series = get_series_line(
            Contribution, group, primary_field=primary_field, addon=addon.id, date__range=date_range
        )

    if format == "csv":
        return render_csv(request, addon, series, ["date", "count"])
    elif format == "json":
        return render_json(request, addon, series)
开发者ID:rtnpro,项目名称:zamboni,代码行数:27,代码来源:views.py

示例2: usage_series

def usage_series(request, addon, group, start, end, format):
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon)

    series = get_series_line(UpdateCount, group, addon=addon.id, date__range=date_range)

    if format == "csv":
        return render_csv(request, addon, series, ["date", "count"])
    elif format == "json":
        return render_json(request, addon, series)
开发者ID:pombredanne,项目名称:zamboni,代码行数:10,代码来源:views.py

示例3: usage_series

def usage_series(request, addon, group, start, end, format):
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon)

    series = get_series(UpdateCount, addon=addon.id, date__range=date_range)

    if format == 'csv':
        return render_csv(request, addon, series, ['date', 'count'])
    elif format == 'json':
        return render_json(request, addon, series)
开发者ID:gkoberger,项目名称:zamboni,代码行数:10,代码来源:views.py

示例4: overview_series

def overview_series(request, addon, group, start, end, format):
    """Combines installs_series and usage_series into one payload."""
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon)

    return fake_app_stats(request, addon, group, start, end, format)

    series = get_series(Installed, addon=addon.id, date__range=date_range)

    return render_json(request, addon, series)
开发者ID:gkoberger,项目名称:zamboni,代码行数:10,代码来源:views.py

示例5: refunds_series

def refunds_series(request, addon, group, start, end, format):
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon, for_contributions=True)

    series = get_series(Contribution, group, primary_field="refunds", addon=addon.id, date__range=date_range)

    if format == "csv":
        return render_csv(request, addon, series, ["date", "count"])
    elif format == "json":
        return render_json(request, addon, series)
开发者ID:canuckistani,项目名称:zamboni,代码行数:10,代码来源:views.py

示例6: installs_series

def installs_series(request, addon, group, start, end, format):
    """Generate install counts grouped by ``group`` in ``format``."""
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon)
    series = get_series(Installed, addon=addon.id, date__range=date_range)

    if format == 'csv':
        return render_csv(request, addon, series, ['date', 'count'])
    elif format == 'json':
        return render_json(request, addon, series)
开发者ID:beenishkhan,项目名称:zamboni,代码行数:10,代码来源:views.py

示例7: refunds_series

def refunds_series(request, addon, group, start, end, format):
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon, for_contributions=True)

    series = get_series(Contribution, group, primary_field='refunds',
        addon=addon.id, date__range=date_range)

    if format == 'csv':
        return render_csv(request, addon, series, ['date', 'count'])
    elif format == 'json':
        return render_json(request, addon, series)
开发者ID:icaaq,项目名称:zamboni,代码行数:11,代码来源:views.py

示例8: overview_series

def overview_series(request, addon, group, start, end, format):
    """Combines installs_series and usage_series into one payload."""
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon)

    series = get_series(Installed, group, addon=addon.id, date__range=date_range)

    if format == "csv":
        return render_csv(request, addon, series, ["date", "count"])
    elif format == "json":
        return render_json(request, addon, series)
开发者ID:canuckistani,项目名称:zamboni,代码行数:11,代码来源:views.py

示例9: overview_series

def overview_series(request, addon, group, start, end, format):
    """Combines installs_series and usage_series into one payload."""
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon)

    dls = get_series(DownloadCount, addon=addon.id, date__range=date_range)

    # Uncomment the line below to return fake stats.
    return fake_app_stats(request, addon, group, start, end, format)

    return render_json(request, addon, dls)
开发者ID:beenishkhan,项目名称:zamboni,代码行数:11,代码来源:views.py

示例10: sales_series

def sales_series(request, addon, group, start, end, format):
    """
    Sequel to contribution series
    """
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon, for_contributions=True)

    series = get_series(Contribution, addon=addon.id, date__range=date_range)

    if format == 'csv':
        return render_csv(request, addon, series, ['date', 'count'])
    elif format == 'json':
        return render_json(request, addon, series)
开发者ID:gkoberger,项目名称:zamboni,代码行数:13,代码来源:views.py

示例11: usage_series

def usage_series(request, addon, group, start, end, format):
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon)

    series = get_series(DownloadCount, addon=addon.id, date__range=date_range)

    # Uncomment the line below to return fake stats.
    return fake_app_stats(request, addon, group, start, end, format)

    if format == 'csv':
        return render_csv(request, addon, series, ['date', 'count'])
    elif format == 'json':
        return render_json(request, addon, series)
开发者ID:beenishkhan,项目名称:zamboni,代码行数:13,代码来源:views.py

示例12: finance_line_series

def finance_line_series(request, addon, group, start, end, format, primary_field=None):
    """
    Date-based contribution series.
    primary_field -- revenue/count/refunds
    """
    date_range = check_series_params_or_404(group, start, end, format)
    check_stats_permission(request, addon, for_contributions=True)

    series = get_series_line(Contribution, group, primary_field=primary_field, addon=addon.id, date__range=date_range)

    if format == "csv":
        return render_csv(request, addon, series, ["date", "count"])
    elif format == "json":
        return render_json(request, addon, series)
开发者ID:pombredanne,项目名称:zamboni,代码行数:14,代码来源:views.py

示例13: fake_app_stats

def fake_app_stats(request, addon, group, start, end, format):
    from time import strftime
    from math import sin, floor
    start, end = check_series_params_or_404(group, start, end, format)
    faked = []
    val = 0
    for single_date in daterange(start, end):
        isodate = strftime("%Y-%m-%d", single_date.timetuple())
        faked.append({
         'date': isodate,
         'count': floor(200 + 50 * sin(val + 1)),
         'data': {
            'installs': floor(200 + 50 * sin(2 * val + 2)),
            'usage': floor(200 + 50 * sin(3 * val + 3)),
            #'device': floor(200 + 50 * sin(5 * val + 5)),
        }})
        val += .01
    return faked
开发者ID:KryDos,项目名称:zamboni,代码行数:18,代码来源:views.py

示例14: my_apps_series

def my_apps_series(request, group, start, end, format):
    """
    Install counts for multiple apps. This is a temporary hack that will
    probably live forever.
    """
    date_range = check_series_params_or_404(group, start, end, format)
    apps = _my_apps(request)
    series = []
    for app in apps:
        # The app name is going to appended in slightly different ways
        # depending upon data format.
        if format == "csv":
            series = get_series_line(
                Installed, group, addon=app.id, date__range=date_range, extra_values={"name": (app.name)}
            )
        elif format == "json":
            data = get_series_line(Installed, group, addon=app.id, date__range=date_range)
            series.append({"name": str(app.name), "data": list(data)})

    if format == "csv":
        return render_csv(request, apps, series, ["name", "date", "count"])
    elif format == "json":
        return render_json(request, apps, series)
开发者ID:pombredanne,项目名称:zamboni,代码行数:23,代码来源:views.py


注:本文中的stats.views.check_series_params_or_404函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。