def handle_delete(request):
 index_to_delete = request.POST.get('delete_index')
 es_indexes = [name for (name, count) in get_indexes()]
 if (not index_to_delete.startswith(settings.ES_INDEX_PREFIX)):
  raise DeleteError(('"%s" is not a valid index name.' % index_to_delete))
 if (index_to_delete not in es_indexes):
  raise DeleteError(('"%s" does not exist.' % index_to_delete))
 if (index_to_delete == read_index('default')):
  raise DeleteError(('"%s" is the default read index.' % index_to_delete))
 delete_index(index_to_delete)
 return HttpResponseRedirect(request.path)

def handle_delete ( request ) : index_to_delete = request . POST . get ( 'delete_index' ) es_indexes = [ name for ( name , count ) in get_indexes ( ) ] if ( not index_to_delete . startswith ( settings . ES_INDEX_PREFIX ) ) : raise DeleteError ( ( '"%s" is not a valid index name.' % index_to_delete ) ) if ( index_to_delete not in es_indexes ) : raise DeleteError ( ( '"%s" does not exist.' % index_to_delete ) ) if ( index_to_delete == read_index ( 'default' ) ) : raise DeleteError ( ( '"%s" is the default read index.' % index_to_delete ) ) delete_index ( index_to_delete ) return HttpResponseRedirect ( request . path )
deletes an index .