# Path: flask_superadmin/model/base.py
# class AdminModelConverter(object):
#     def convert(self, *args, **kwargs):
#         field = super(AdminModelConverter, self).convert(*args, **kwargs)
#         if field:
#             widget = field.kwargs.get('widget', field.field_class.widget)
#             if isinstance(widget, widgets.Select):
#                 field.kwargs['widget'] = ChosenSelectWidget(
#                     multiple=widget.multiple)
#             elif issubclass(field.field_class, fields.DateTimeField):
#                 field.kwargs['widget'] = DateTimePickerWidget()
#             elif issubclass(field.field_class, fields.DateField):
#                 field.kwargs['widget'] = DatePickerWidget()
#             elif issubclass(field.field_class, fields.FileField):
#                 field.field_class = FileField
#         return field


import inspect
import mongoengine.fields as fields
from werkzeug import secure_filename
from wtforms import Form, validators, fields as f
from fields import ModelSelectField, ModelSelectMultipleField, ListField
from mongoengine.fields import ReferenceField, IntField, FloatField
from flask_superadmin.model import AdminModelConverter as AdminModelConverter_
    from mongoengine.base import BaseDocument
        from bson.objectid import ObjectId
    from inspect import isclass
    :param model:
        A MongoEngine Document schema class
    :param base_class:
        Base form class to extend from. Must be a ``wtforms.Form`` subclass.
    :param fields:
        An optional iterable with the property names that should be included
        in the form. Only these properties will have fields. It also
        determines the order of the fields.
    :param exclude:
        An optional iterable with the property names that should be excluded
        from the form. All other properties will have fields.
    :param field_args:
        An optional dictionary of field names mapping to keyword arguments used
        to construct each field object.
    :param converter:
        A converter to generate the fields based on the model properties. If
        not set, ``ModelConverter`` is used.
    """
    field_dict = model_fields(model, fields, readonly_fields, exclude,
                              field_args, converter)
    field_dict['model_class'] = model

    def populate_obj(self, obj):
        return data_to_document(obj, self.data)

    field_dict['populate_obj'] = populate_obj

    return type(model.__name__ + 'Form', (base_class,), field_dict)



# Path: flask_superadmin/model/base.py
# class AdminModelConverter(object):
#     def convert(self, *args, **kwargs):
#         field = super(AdminModelConverter, self).convert(*args, **kwargs)
#         if field:
#             widget = field.kwargs.get('widget', field.field_class.widget)
#             if isinstance(widget, widgets.Select):
#                 field.kwargs['widget'] = ChosenSelectWidget(
#                     multiple=widget.multiple)
#             elif issubclass(field.field_class, fields.DateTimeField):
#                 field.kwargs['widget'] = DateTimePickerWidget()
#             elif issubclass(field.field_class, fields.DateField):
#                 field.kwargs['widget'] = DatePickerWidget()
#             elif issubclass(field.field_class, fields.FileField):
#                 field.field_class = FileField
#         return field


# Path: flask_superadmin/model/backends/mongoengine/orm.py
import inspect
import mongoengine.fields as fields
from werkzeug import secure_filename
from wtforms import Form, validators, fields as f
from fields import ModelSelectField, ModelSelectMultipleField, ListField
from mongoengine.fields import ReferenceField, IntField, FloatField
from flask_superadmin.model import AdminModelConverter as AdminModelConverter_
    from mongoengine.base import BaseDocument
        from bson.objectid import ObjectId
    from inspect import isclass

    :param model:
        A MongoEngine Document schema class
    :param base_class:
        Base form class to extend from. Must be a ``wtforms.Form`` subclass.
    :param fields:
        An optional iterable with the property names that should be included
        in the form. Only these properties will have fields. It also
        determines the order of the fields.
    :param exclude:
        An optional iterable with the property names that should be excluded
        from the form. All other properties will have fields.
    :param field_args:
        An optional dictionary of field names mapping to keyword arguments used
        to construct each field object.
    :param converter:
        A converter to generate the fields based on the model properties. If
        not set, ``ModelConverter`` is used.
    """
    field_dict = model_fields(model, fields, readonly_fields, exclude,
                              field_args, converter)
    field_dict['model_class'] = model

    def populate_obj(self, obj):
        return data_to_document(obj, self.data)

    field_dict['populate_obj'] = populate_obj

    return type(model.__name__ + 'Form', (base_class,), field_dict)



class AdminModelConverter(AdminModelConverter_, ModelConverter):