widget
It's currently not yet possible to create your own widgets for the admin panel
but you can select one of the built-in widgets for your own type. Note that
not all widgets will necessarily will work directly with your type as such.
For instance the select
widget and some others will currently require some
extra values be supplied in the to_json method.
from lektor.types import Type
class MyThingType(Type):
widget = 'singleline-text'
def value_from_raw(self, raw):
return raw.value
These widgets are currently available:
singleline-text
: single-line text input fieldmultiline-text
: multi-line text input fielddatepicker
: a date input field (currently not yet an actual date picker)integer
: an integer input fieldfloat
: a floating point value input fieldcheckbox
: a checkboxurl
: a URL input fieldslug
: input field for URL slugscheckboxes
: an input field with multiple checkboxes *select
: an input field in the form of a select box ** checkboxes
and select
require a choices
list to be supplied which is
a list of [value, label]
tuples where value is the stored value and label
is a dictionary of internationalized values for the UI. For more information
you will currently have to refer to the Lektor sourcecode.
Comments