diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-07-02 19:58:25 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-08-13 18:26:03 +0200 |
commit | 31873237b90c588f49f403721a382df59719ca1b (patch) | |
tree | 38143096a878386d25f9d950a8c4248a30187344 /ishtar_common/forms.py | |
parent | 8533647dd9c2eb008ccfca14813e055e1f5708ef (diff) | |
download | Ishtar-31873237b90c588f49f403721a382df59719ca1b.tar.bz2 Ishtar-31873237b90c588f49f403721a382df59719ca1b.zip |
Full text search: manage facet search (simple, hierarchic, OR) (refs #4180)
Diffstat (limited to 'ishtar_common/forms.py')
-rw-r--r-- | ishtar_common/forms.py | 10 |
1 files changed, 8 insertions, 2 deletions
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' |