本文整理匯總了Python中crashstats.supersearch.models.SuperSearchField.create_field方法的典型用法代碼示例。如果您正苦於以下問題:Python SuperSearchField.create_field方法的具體用法?Python SuperSearchField.create_field怎麽用?Python SuperSearchField.create_field使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類crashstats.supersearch.models.SuperSearchField
的用法示例。
在下文中一共展示了SuperSearchField.create_field方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: supersearch_field_create
# 需要導入模塊: from crashstats.supersearch.models import SuperSearchField [as 別名]
# 或者: from crashstats.supersearch.models.SuperSearchField import create_field [as 別名]
def supersearch_field_create(request):
field_data = _get_supersearch_field_data(request.POST)
if isinstance(field_data, basestring):
return http.HttpResponseBadRequest(field_data)
api = SuperSearchField()
api.create_field(**field_data)
_delete_supersearch_fields_api_cache(namespace=field_data['namespace'])
log(request.user, 'supersearch_field.post', field_data)
# Refresh the cache for the fields service.
SuperSearchFields().get(refresh_cache=True)
SuperSearch.clear_implementations_cache()
return redirect(reverse('manage:supersearch_fields'))
示例2: supersearch_field_create
# 需要導入模塊: from crashstats.supersearch.models import SuperSearchField [as 別名]
# 或者: from crashstats.supersearch.models.SuperSearchField import create_field [as 別名]
def supersearch_field_create(request):
field_data = _get_supersearch_field_data(request.POST)
if isinstance(field_data, basestring):
return http.HttpResponseBadRequest(field_data)
api = SuperSearchField()
api.create_field(**field_data)
log(request.user, 'supersearch_field.post', field_data)
# Refresh the cache for the fields service.
SuperSearchFields().get(refresh_cache=True)
# The API is using cache to get all fields by a specific namespace
# for the whitelist lookup, clear that cache too.
cache.delete('api_supersearch_fields_%s' % field_data['namespace'])
return redirect(reverse('manage:supersearch_fields'))