• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python views.render_json函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: finance_column_series

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

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

    # 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:pombredanne,项目名称:zamboni,代码行数:21,代码来源:views.py


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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python statsd.StatsClient类代码示例发布时间:2022-05-27
下一篇:
Python views.render_csv函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap