integereditor

class camelot.view.controls.editors.integereditor.IntegerEditor(parent=None, minimum=-2147483648, maximum=2147483647, calculator=True, option=None, field_name='integer', **kwargs)[source]

Widget for editing an integer field, with a calculator

Special use cases of the IntegerEditor :

we have a required integer field without a default.

so the model will do set_value( None )

since this is a required field, the user should be able to enter a value, 0 is a legitimate value.

when get_value is called, 0 should be returned if the user has set the editor to 0, and None if the user didn’t touch the editor.

so the editor should make a visual difference between None and 0, so the user can see he didn’t enter something yet

we have a non required integer field without a default

the model will do set_value( None )

the get_value() should return None and not 0. because in case it returns 0, 0 will be written to the db, causing an unneeded update of the db.

Previous topic

imageeditor

Next topic

labeleditor

This Page