def convert(self, model, field, field_args, multiple=False):
        kwargs = {
            'label': unicode(field.verbose_name or field.name or ''),
            'description': field.help_text or '',
            'validators': [],
            'filters': [],
            'default': field.default,
        }
        if field_args:
            kwargs.update(field_args)

        if field.required:

            # Hacky but necessary, since validators.Required doesn't handle 0 properly
            if isinstance(field, IntField) or isinstance(field, FloatField):
                kwargs['validators'].append(validators.InputRequired())
            else:
                kwargs['validators'].append(validators.Required())
        else:
            kwargs['validators'].append(validators.Optional())

        if field.choices:
            kwargs['choices'] = field.choices
            if isinstance(field, IntField):
                kwargs['coerce'] = int
            if not multiple:
                return f.SelectField(**kwargs)
            else:
                return f.SelectMultipleField(**kwargs)
        ftype = type(field).__name__

        if hasattr(field, 'to_form_field'):
            return field.to_form_field(model, kwargs)

        if ftype in self.converters:
            return self.converters[ftype](model, field, kwargs)
dataset/ETHPy150Open syrusakbary/Flask-SuperAdmin/flask_superadmin/model/backends/mongoengine/orm.py/ModelConverter.convert/original