本文整理汇总了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)
示例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)