def conv_EmbeddedDocument(self, model, field, kwargs): # FormField does not support validators kwargs['validators'] = [] view = self._get_subdocument_config(field.name) form_opts = form.FormOpts(widget_args=getattr(view, 'form_widget_args', None), form_rules=view._form_rules) form_class = view.get_form() if form_class is None: converter = self.clone_converter(view) form_class = get_form(field.document_type_obj, converter, base_class=view.form_base_class or form.BaseForm, only=view.form_columns, exclude=view.form_excluded_columns, field_args=view.form_args, extra_fields=view.form_extra_fields) form_class = view.postprocess_form(form_class) return ModelFormField(field.document_type_obj, view, form_class, form_opts=form_opts, **kwargs)
def __init__(self, frm, session, model, prop, inline_view, **kwargs): self.form = frm self.session = session self.model = model self.prop = prop self.inline_view = inline_view self._pk = 'id' form_opts = form.FormOpts(widget_args=getattr(inline_view, 'form_widget_args', None), form_rules=inline_view._form_rules) form_field = self.form_field_type(frm, self._pk, form_opts=form_opts) super(InlineModelFormList, self).__init__(form_field, **kwargs)