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


Python views.render_json函数代码示例

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


在下文中一共展示了render_json函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: finance_column_series

def finance_column_series(request, addon, group, start, end, format,
                          primary_field=None, category_field=None,
                          inapp=None):
    """
    Non-date-based contribution series, column graph.
    primary_field -- revenue/count/refunds
    category_field -- breakdown field, currency/source
    inapp -- inapp name, which shows stats for a certain inapp
    """
    check_stats_permission(request, addon, for_contributions=True)

    if not inapp:
        series = get_series_column(Contribution, primary_field=primary_field,
            category_field=category_field, addon=addon.id)
    else:
        series = get_series_column(InappPayment, primary_field=primary_field,
            category_field=category_field, config__addon=addon.id,
            name=inapp.lower())

    # Since we're currently storing everything in lower-case in ES,
    # re-capitalize the currency.
    if category_field == 'currency':
        series = list(series)
        for datum in series:
            datum['currency'] = datum['currency'].upper()

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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例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)

    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

示例9: 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

示例10: source_series

def source_series(request, addon, group, start, end, format,
                  primary_field=None):
    check_stats_permission(request, addon, for_contributions=True)

    series = get_series_column(Contribution, primary_field=primary_field,
                               category_field='source', addon=addon.id)

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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: currency_series

def currency_series(request, addon, group, start, end, format,
                    primary_field=None):
    check_stats_permission(request, addon, for_contributions=True)

    series = get_series_column(Contribution, primary_field=primary_field,
                               category_field='currency', addon=addon.id)

    # Since we're currently storing everything in lower-case in ES,
    # re-capitalize the currency.
    series = list(series)
    for datum in series:
        datum['currency'] = datum['currency'].upper()

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


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