From 3a69158af388041e475656700e9a7fe2c86d186b Mon Sep 17 00:00:00 2001 From: Alexei Peters Date: Tue, 30 Apr 2019 16:36:27 -0700 Subject: [PATCH] remove unneccesary view, re #4771 --- arches/app/views/search.py | 68 ++------------------------------------ arches/urls.py | 1 - 2 files changed, 2 insertions(+), 67 deletions(-) diff --git a/arches/app/views/search.py b/arches/app/views/search.py index aeccbe2e7cc..2ca3f90329a 100644 --- a/arches/app/views/search.py +++ b/arches/app/views/search.py @@ -66,6 +66,7 @@ def get(self, request): resource_cards = models.CardModel.objects.filter(graph__isresource=True, graph__isactive=True) datatypes = models.DDataType.objects.all() geocoding_providers = models.Geocoder.objects.all() + search_components = models.SearchComponent.objects.all() # only allow cards that the user has permission to read searchable_cards = [] for card in resource_cards: @@ -87,72 +88,7 @@ def get(self, request): map_markers=map_markers, map_sources=map_sources, geocoding_providers=geocoding_providers, - main_script='views/search', - resource_graphs=resource_graphs, - datatypes=datatypes, - datatypes_json=JSONSerializer().serialize(datatypes), - user_is_reviewer=request.user.groups.filter(name='Resource Reviewer').exists() - ) - - graphs = JSONSerializer().serialize( - context['resource_graphs'], - exclude=['functions', - 'author', - 'deploymentdate', - 'deploymentfile', - 'version', - 'subtitle', - 'description', - 'disable_instance_creation', - 'ontology_id']) - context['graphs'] = graphs - context['graph_models'] = models.GraphModel.objects.all().exclude(graphid=settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID) - context['nav']['title'] = _('Search') - context['nav']['icon'] = 'fa-search' - context['nav']['search'] = False - context['nav']['help'] = { - 'title': _('Searching the Database'), - 'template': 'search-help', - } - - return render(request, 'views/search.htm', context) - - -class NewSearchView(MapBaseManagerView): - - def get(self, request): - saved_searches = JSONSerializer().serialize(settings.SAVED_SEARCHES) - map_layers = models.MapLayer.objects.all() - map_markers = models.MapMarker.objects.all() - map_sources = models.MapSource.objects.all() - date_nodes = models.Node.objects.filter(Q(datatype='date') | Q(datatype='edtf'), graph__isresource=True, graph__isactive=True) - resource_graphs = models.GraphModel.objects.exclude(pk=settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID).exclude(isresource=False).exclude(isactive=False) - searchable_datatypes = [d.pk for d in models.DDataType.objects.filter(issearchable=True)] - searchable_nodes = models.Node.objects.filter(graph__isresource=True, graph__isactive=True, datatype__in=searchable_datatypes, issearchable=True) - resource_cards = models.CardModel.objects.filter(graph__isresource=True, graph__isactive=True) - datatypes = models.DDataType.objects.all() - geocoding_providers = models.Geocoder.objects.all() - # only allow cards that the user has permission to read - searchable_cards = [] - for card in resource_cards: - if request.user.has_perm('read_nodegroup', card.nodegroup): - searchable_cards.append(card) - - # only allow date nodes that the user has permission to read - searchable_date_nodes = [] - for node in date_nodes: - if request.user.has_perm('read_nodegroup', node.nodegroup): - searchable_date_nodes.append(node) - - context = self.get_context_data( - resource_cards=JSONSerializer().serialize(searchable_cards), - searchable_nodes=JSONSerializer().serialize(searchable_nodes), - saved_searches=saved_searches, - date_nodes=searchable_date_nodes, - map_layers=map_layers, - map_markers=map_markers, - map_sources=map_sources, - geocoding_providers=geocoding_providers, + search_components=search_components, main_script='views/search', resource_graphs=resource_graphs, datatypes=datatypes, diff --git a/arches/urls.py b/arches/urls.py index bd0eee45bc3..96a11f9101d 100644 --- a/arches/urls.py +++ b/arches/urls.py @@ -69,7 +69,6 @@ url(r'^concepts/get_pref_label', concept.get_pref_label, name="get_pref_label"), url(r'^conceptvalue/', concept.concept_value, name="concept_value"), url(r'^search$', search.SearchView.as_view(), name="search_home"), - url(r'^new_search$', search.NewSearchView.as_view(), name="new_search_home"), url(r'^search/terms$', search.search_terms, name="search_terms"), url(r'^search/resources$', search.search_results, name="search_results"), url(r'^search/time_wheel_config$', search.time_wheel_config, name="time_wheel_config"),