Skip to content

Commit a90b110

Browse files
committed
[Fixes #13190] Make the Thesaurus autocomplete referenceable by identifier
1 parent f975781 commit a90b110

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

geonode/metadata/api/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ def schema_instance(self, request, pk=None):
135135
def tkeywords_autocomplete(request: WSGIRequest, thesaurusid):
136136

137137
lang = remove_country_from_languagecode(get_language())
138-
all_keywords_qs = ThesaurusKeyword.objects.filter(thesaurus_id=thesaurusid)
138+
139+
try:
140+
all_keywords_qs = ThesaurusKeyword.objects.filter(thesaurus_id=thesaurusid)
141+
except ValueError:
142+
all_keywords_qs = ThesaurusKeyword.objects.filter(thesaurus__identifier=thesaurusid)
139143

140144
# try find results found for given language e.g. (en-us) if no results found remove country code from language to (en) and try again
141145
localized_k_ids_qs = ThesaurusKeywordLabel.objects.filter(lang=lang, keyword_id__in=all_keywords_qs).values(

0 commit comments

Comments
 (0)