Skip to content

Commit

Permalink
remove unneccesary view, re #4771
Browse files Browse the repository at this point in the history
  • Loading branch information
apeters committed Apr 30, 2019
1 parent 6814b3d commit 3a69158
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 67 deletions.
68 changes: 2 additions & 66 deletions arches/app/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion arches/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 3a69158

Please sign in to comment.