autocomplete_initfuncs is now expected as widget argument
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 14 Aug 2009 15:44:27 +0200
changeset 23 6a6a97aba6cf
parent 22 838ad9dc61ef
child 24 3727402422b4
autocomplete_initfuncs is now expected as widget argument
entities.py
views/__init__.py
--- a/entities.py	Mon Jul 27 08:33:09 2009 +0200
+++ b/entities.py	Fri Aug 14 15:44:27 2009 +0200
@@ -1,10 +1,6 @@
 """this contains the template-specific entities' classes"""
 
-from cubes.expense.entities import Expense as BaseExpense, ExpenseLine as BaseExpenseLine
-
-class Expense(BaseExpense):
-    autocomplete_initfuncs = {'spent_for' : 'get_concerned_by'}
-
+from cubes.expense.entities import ExpenseLine as BaseExpenseLine
 
 class ExpenseLine(BaseExpenseLine):
 
--- a/views/__init__.py	Mon Jul 27 08:33:09 2009 +0200
+++ b/views/__init__.py	Fri Aug 14 15:44:27 2009 +0200
@@ -5,10 +5,11 @@
 from cubicweb.web.formwidgets import RestrictedAutoCompletionWidget
 from cubicweb.web.views import basecontrollers
 
-uicfg.autoform_section.tag_subject_of(('Expense', 'spent_for', '*'), 'primary')
-uicfg.autoform_field_kwargs.tag_subject_of(('Expense', 'spent_for', '*'),
-                                           {'widget': RestrictedAutoCompletionWidget})
-
+_afs = uicfg.autoform_section
+_afs.tag_subject_of(('Expense', 'spent_for', '*'), 'primary')
+_affk = uicfg.autoform_field_kwargs
+_affk.tag_subject_of(('Expense', 'spent_for', '*'),
+                     {'widget': RestrictedAutoCompletionWidget(autocomplete_initfunc='get_concerned_by')})
 
 
 @monkeypatch(basecontrollers.JSonController)