Skip to content

Commit

Permalink
glamr/search: fix crash on full text search coming from certain pages
Browse files Browse the repository at this point in the history
Some, e.g. FilteredListView /filter/uniref100/, model-based views with
SearchFormMixin where the model is not one of the blessed searchable
ones, so e.g. UniRef100, that non-searchable model was passed to the
search_result view giving a 404 since invalid model.

The fix puts the "global search" placeholder as the model parameter in
those cases.
  • Loading branch information
robert102 committed Nov 26, 2024
1 parent bf869d9 commit f0e3031
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mibios/glamr/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,12 +907,12 @@ def get_context_data(self, **ctx):
]

search_model = self.search_model or self.model
if search_model in [self.ANY_MODEL, None]:
ctx['search_model'] = None
ctx['search_model_name'] = self.ANY_MODEL_URL_PART
else:
if search_model in self.model_class.values():
ctx['search_model'] = search_model
ctx['search_model_name'] = search_model._meta.model_name
else:
ctx['search_model'] = None
ctx['search_model_name'] = self.ANY_MODEL_URL_PART
return ctx


Expand Down

0 comments on commit f0e3031

Please sign in to comment.