Better guess "selection_change_with" attribute

Testing on the instance for Selection field is not enough because some field
selection could come from a Function field.
So it is better to use a duck typing style in this case.

issue3649
review3451002
This commit is contained in:
Cédric Krier committed 2014-02-14 00:04:31 +01:00
1 parent 6b3f7fb250
commit 729aaa8a00
1 file changed
+2 -2
+2 -2
View File
@@ -53,8 +53,8 @@ class Model(WarningErrorMixin, URLMixin, PoolBase):
for attribute in ('on_change', 'on_change_with', 'autocomplete',
'selection_change_with'):
if attribute == 'selection_change_with':
if (isinstance(field, fields.Selection)
and isinstance(field.selection, basestring)):
if isinstance(
getattr(field, 'selection', None), basestring):
function_name = field.selection
else:
continue