def collections_remove(request): if request.method != 'POST': raise PopupException(_('POST request required.')) response = {'status': -1} collections = json.loads(request.POST.get('collections', '[]')) if not collections: response['message'] = _('No collections to remove.') if response.get('message', None) is None: searcher = CollectionManagerController(request.user) solr_collections = searcher.get_collections() for collection in collections: if collection.get('name') in solr_collections: # Remove collection and instancedir searcher.delete_collection(collection.get('name'), collection.get('isCoreOnly')) response['status'] = 0 response['message'] = _('Collections removed!') return HttpResponse(json.dumps(response), mimetype="application/json")
def collections(request): searcher = CollectionManagerController(request.user) solr_collections = searcher.get_collections() response = { 'status': 0, 'collections': [{'name': collection} for collection in solr_collections] } return HttpResponse(json.dumps(response), mimetype="application/json")
def collections(request): searcher = CollectionManagerController(request.user) solr_collections = searcher.get_collections() response = { 'status': 0, 'collections': [{ 'name': collection } for collection in solr_collections] } return HttpResponse(json.dumps(response), mimetype="application/json")
def collections(request): searcher = CollectionManagerController(request.user) solr_collections = searcher.get_collections() massaged_collections = [] for collection in solr_collections: massaged_collections.append({ 'name': collection, 'isCoreOnly': solr_collections[collection]['isCoreOnly'] }) response = {'status': 0, 'collections': massaged_collections} return HttpResponse(json.dumps(response), mimetype="application/json")
def collections(request): searcher = CollectionManagerController(request.user) solr_collections = searcher.get_collections() massaged_collections = [] for collection in solr_collections: massaged_collections.append({ 'name': collection, 'isCoreOnly': solr_collections[collection]['isCoreOnly'] }) response = {'status': 0, 'collections': massaged_collections} return JsonResponse(response)
def collections(request): searcher = CollectionManagerController(request.user) solr_collections = searcher.get_collections() massaged_collections = [] for collection in solr_collections: massaged_collections.append({ 'name': collection, 'isCoreOnly': solr_collections[collection]['isCoreOnly'] }) response = { 'status': 0, 'collections': massaged_collections } return HttpResponse(json.dumps(response), mimetype="application/json")
def collections(request): searcher = CollectionManagerController(request.user) solr_collections = searcher.get_collections() massaged_collections = [] for collection in solr_collections: massaged_collections.append({ 'name': collection, 'isCoreOnly': solr_collections[collection]['isCoreOnly'] }) response = { 'status': 0, 'collections': massaged_collections } return JsonResponse(response)
def collections_remove(request): if request.method != 'POST': raise PopupException(_('POST request required.')) response = {'status': -1} collections = json.loads(request.POST.get('collections', '[]')) if not collections: response['message'] = _('No collections to remove.') if response.get('message', None) is None: searcher = CollectionManagerController(request.user) solr_collections = searcher.get_collections() for collection in collections: if collection.get('name') in solr_collections: # Remove collection and instancedir searcher.delete_collection(collection.get('name'), collection.get('isCoreOnly')) response['status'] = 0 response['message'] = _('Collections removed!') return JsonResponse(response)