Il 07/03/2012 10:01, Kimmo ha scritto:
I made a (ugly hack) custom widget for all the Fields that have double
type. Now E notation and normal double values work perfectly (edit /
save / viewing).
How do i set this widget as a default widget for all the Fields that
have double type in my model? I would rather like to avoid setting
this to all double Fields manually:
Field('value', 'double', notnull=True, widget=my_double_widget)
what about something like:

def get_my_double_field(name, **kwargs):
return Field(name, 'double', notnull=True, widget=my_double_widget, **kwargs)

and than you can call it in your table definition:

db.define_table('tab_name',
    Field(...),
get_my_double_field('value', label='my value', comment='try inerting a double with scientific notation')
    Field(...),
)

    M.

Reply via email to