[FIX] reimplement quality selection field API
a size attribute of -1 means the selection field is an int4, even if the selection is a callable bzr revid: xmo@openerp.com-20110909161623-nab218ea48ucj4qt
This commit is contained in:
parent
0d965c2fca
commit
9c83238f18
|
@ -517,7 +517,8 @@ def get_pg_type(f, type_override=None):
|
|||
elif issubclass(field_type, (fields.char, fields.reference)):
|
||||
return ('varchar', pg_varchar(f.size))
|
||||
elif issubclass(field_type, fields.selection):
|
||||
if isinstance(f.selection, list) and isinstance(f.selection[0][0], int):
|
||||
if (isinstance(f.selection, list) and isinstance(f.selection[0][0], int))\
|
||||
or getattr(f, 'size', None) == -1:
|
||||
return ('int4', 'INTEGER')
|
||||
return ('varchar', pg_varchar(getattr(f, 'size', None)))
|
||||
elif issubclass(field_type, fields.function):
|
||||
|
|
Loading…
Reference in New Issue