In Python 3 a range(0,10,3) creates a range object rather than a list. We can make use of this to display a range-specific UI element such as slider.
This will require additions to clinto to detect and pass the object type and parameters somehow.
In flask-wooey this was handled and passed as follows:
jsons = []
for action, widget in filtered_actions:
if PY3 and isinstance(action.choices, range):
widget = 'RangeField'
action.choices = (action.choices.start, action.choices.stop, action.choices.step)
elif action.nargs == "+":
# FIXME: We can be smarter here; other possibilities for multiple selections
widget = 'SelectMany'
else:
widget = 'SelectOne'
jsons.append(as_json(action, widget=widget))
return jsons
Since range supports integers only it might make sense to implement this as a range type in TYPE_FIELDS? The parameters for the range can then be passed to the field definition.
wooey/django-djangui#9
In Python 3 a
range(0,10,3)creates a range object rather than a list. We can make use of this to display a range-specific UI element such as slider.This will require additions to
clintoto detect and pass the object type and parameters somehow.In flask-wooey this was handled and passed as follows:
Since range supports integers only it might make sense to implement this as a
rangetype inTYPE_FIELDS? The parameters for the range can then be passed to the field definition.wooey/django-djangui#9