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


Python SuperSearchFields.get方法代码示例

本文整理汇总了Python中crashstats.supersearch.models.SuperSearchFields.get方法的典型用法代码示例。如果您正苦于以下问题:Python SuperSearchFields.get方法的具体用法?Python SuperSearchFields.get怎么用?Python SuperSearchFields.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在crashstats.supersearch.models.SuperSearchFields的用法示例。


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

示例1: supersearch_field

# 需要导入模块: from crashstats.supersearch.models import SuperSearchFields [as 别名]
# 或者: from crashstats.supersearch.models.SuperSearchFields import get [as 别名]
def supersearch_field(request):
    context = {}

    field_name = request.GET.get("name")

    if field_name:
        all_fields = SuperSearchFields().get()
        field_data = all_fields.get(field_name)

        if not field_data:
            return http.HttpResponseBadRequest('The field "%s" does not exist' % field_name)
    else:
        full_name = request.GET.get("full_name")

        if full_name:
            if "." not in full_name:
                name = full_name
                namespace = None
            else:
                namespace, name = full_name.rsplit(".", 1)
            field_data = {"in_database_name": name, "namespace": namespace}
        else:
            field_data = {}

    context["field"] = field_data
    perms = Permission.objects.filter(content_type__model="").order_by("name")
    context["all_permissions"] = ["crashstats." + x.codename for x in perms]

    return render(request, "manage/supersearch_field.html", context)
开发者ID:andreja-cliqz,项目名称:socorro,代码行数:31,代码来源:views.py

示例2: supersearch_field

# 需要导入模块: from crashstats.supersearch.models import SuperSearchFields [as 别名]
# 或者: from crashstats.supersearch.models.SuperSearchFields import get [as 别名]
def supersearch_field(request):
    context = {}

    field_name = request.GET.get('name')

    if field_name:
        all_fields = SuperSearchFields().get()
        field_data = all_fields.get(field_name)

        if not field_data:
            return http.HttpResponseBadRequest(
                'The field "%s" does not exist' % field_name
            )
    else:
        field_data = {}

    context['field'] = field_data
    perms = Permission.objects.filter(content_type__model='').order_by('name')
    context['all_permissions'] = [
        'crashstats.' + x.codename for x in perms
    ]

    return render(request, 'manage/supersearch_field.html', context)
开发者ID:JohanVanZyl,项目名称:socorro,代码行数:25,代码来源:views.py


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