本文整理汇总了Python中search.search_controller.SearchController.is_collection方法的典型用法代码示例。如果您正苦于以下问题:Python SearchController.is_collection方法的具体用法?Python SearchController.is_collection怎么用?Python SearchController.is_collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search.search_controller.SearchController
的用法示例。
在下文中一共展示了SearchController.is_collection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: admin_collection_properties
# 需要导入模块: from search.search_controller import SearchController [as 别名]
# 或者: from search.search_controller.SearchController import is_collection [as 别名]
def admin_collection_properties(request, collection_id):
hue_collection = Collection.objects.get(id=collection_id)
solr_collection = SolrApi(SOLR_URL.get(), request.user).collection_or_core(hue_collection)
if request.method == 'POST':
collection_form = CollectionForm(request.POST, instance=hue_collection, user=request.user)
if collection_form.is_valid():
searcher = SearchController(request.user)
hue_collection = collection_form.save(commit=False)
hue_collection.is_core_only = not searcher.is_collection(hue_collection.name)
hue_collection.save()
return redirect(reverse('search:admin_collection_properties', kwargs={'collection_id': hue_collection.id}))
else:
request.error(_('Errors on the form: %s.') % collection_form.errors)
else:
collection_form = CollectionForm(instance=hue_collection)
return render('admin_collection_properties.mako', request, {
'solr_collection': solr_collection,
'hue_collection': hue_collection,
'collection_form': collection_form,
})