kvesteri/wtforms-components

widgets.BaseDateTimeInput fails if min or max is a callable

cocosx opened this issue · 0 comments

  File ".../venv/lib/python2.7/site-packages/wtforms/fields/core.py", line 149, in __call__
    return self.meta.render_field(self, kwargs)
  File ".../venv/lib/python2.7/site-packages/wtforms/meta.py", line 53, in render_field
    return field.widget(field, **render_kw)
  File ".../venv/lib/python2.7/site-packages/wtforms_components/widgets.py", line 74, in __call__
    for key, value in self.range_validators(field).items():
  File ".../venv/lib/python2.7/site-packages/wtforms_components/widgets.py", line 99, in range_validators
    data['min'] = data['min'].strftime(self.format)
AttributeError: 'function' object has no attribute 'strftime'

Probably should be handeled similarly to validators.BaseDateTimeRange.__call__
As a workaround, I do

from wtforms_components.widgets import BaseDateTimeInput
BaseDateTimeInput.range_validator_class = int #any random class