Skip to content
Snippets Groups Projects
Commit 57a92eae8941 authored by Adrien Di Mascio's avatar Adrien Di Mascio
Browse files

[widgets] use LazyRestrictedAutoCompletionWidget instead of RestirectedAUtoCompletionWidget

parent ab6783fd3a15
No related branches found
No related tags found
No related merge requests found
......@@ -9,9 +9,13 @@
_afs.tag_subject_of(('Expense', 'spent_for', '*'), 'main', 'attributes')
_afs.tag_subject_of(('Expense', 'spent_for', '*'), 'muledit', 'attributes')
_affk.tag_subject_of(('Expense', 'spent_for', '*'),
{'widget': fw.RestrictedAutoCompletionWidget(autocomplete_initfunc='get_concerned_by')})
{'widget': fw.LazyRestrictedAutoCompletionWidget(
autocomplete_initfunc='get_concerned_by',
autocomplete_settings={'limit': 100,
'delay': 300}),
})
@monkeypatch(basecontrollers.JSonController)
@basecontrollers.jsonize
def js_get_concerned_by(self):
......@@ -13,6 +17,11 @@
@monkeypatch(basecontrollers.JSonController)
@basecontrollers.jsonize
def js_get_concerned_by(self):
return self._cw.execute('DISTINCT Any W,R ORDERBY R WHERE W ref R').rows
term = self._cw.form['q']
limit = self._cw.form.get('limit', 50)
return [{'value': eid, 'label': ref}
for eid, ref in self._cw.execute('DISTINCT Any W,R ORDERBY R LIMIT %s WHERE W ref R,'
'W ref ILIKE %%(term)s' % limit,
{'term': u'%%%s%%' % term})]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment