summaryrefslogtreecommitdiff
path: root/ishtar_common/forms.py
diff options
context:
space:
mode:
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
commit6029e4f0e58451848e2c4812d107aae190aa10c7 (patch)
tree38143096a878386d25f9d950a8c4248a30187344 /ishtar_common/forms.py
parent9de2c94a7a528e1ae24bc2a0a9bb9354329d0a93 (diff)
downloadIshtar-6029e4f0e58451848e2c4812d107aae190aa10c7.tar.bz2
Ishtar-6029e4f0e58451848e2c4812d107aae190aa10c7.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.py10
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'