From 31873237b90c588f49f403721a382df59719ca1b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 2 Jul 2018 19:58:25 +0200 Subject: Full text search: manage facet search (simple, hierarchic, OR) (refs #4180) --- ishtar_common/forms.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ishtar_common/forms.py') diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index e01e74a14..bb468eff1 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -461,13 +461,19 @@ class IshtarForm(forms.Form): class TableSelect(IshtarForm): def __init__(self, *args, **kwargs): super(TableSelect, self).__init__(*args, **kwargs) - # no field is required for search + ALT_NAMES = {} + if hasattr(self, '_model') and hasattr(self._model, "ALT_NAMES"): + ALT_NAMES = self._model.ALT_NAMES for k in self.fields: - self.fields[k].required = False + self.fields[k].required = False # no field is required for search cls = 'form-control' if k == 'search_vector': cls += " search-vector" self.fields[k].widget.attrs['class'] = cls + if k in ALT_NAMES: + self.fields[k].alt_name = ALT_NAMES[k] + else: + self.fields[k].alt_name = k key = self.fields.keys()[0] self.fields[key].widget.attrs['autofocus'] = 'autofocus' -- cgit v1.2.3