def conv_List(self, model, field, kwargs): if field.field is None: raise ValueError( 'ListField "%s" must have field specified for model %s' % (field.name, model)) if isinstance(field.field, ReferenceField): kwargs['widget'] = form.Select2Widget(multiple=True) doc_type = field.field.document_type return mongo_fields.ModelSelectMultipleField(model=doc_type, **kwargs) # Create converter view = self._get_subdocument_config(field.name) converter = self.clone_converter(view) if field.field.choices: kwargs['multiple'] = True return converter.convert(model, field.field, kwargs) unbound_field = converter.convert(model, field.field, {}) kwargs = { 'validators': [], 'filters': [], } return InlineFieldList(unbound_field, min_entries=0, **kwargs)
def conv_List(self, model, field, kwargs): if field.field is None: raise ValueError( 'ListField "%s" must have field specified for model %s' % (field.name, model)) if isinstance(field.field, ReferenceField): loader = getattr(self.view, '_form_ajax_refs', {}).get(field.name) if loader: return AjaxSelectMultipleField(loader, **kwargs) kwargs['widget'] = form.Select2Widget(multiple=True) # TODO: Support AJAX multi-select doc_type = field.field.document_type return mongo_fields.ModelSelectMultipleField(model=doc_type, **kwargs) # Create converter view = self._get_subdocument_config(field.name) converter = self.clone_converter(view) if field.field.choices: kwargs['multiple'] = True return converter.convert(model, field.field, kwargs) unbound_field = converter.convert(model, field.field, {}) return InlineFieldList(unbound_field, min_entries=0, **kwargs)
def conv_List(self, model, field, kwargs): if isinstance(field.field, ReferenceField): kwargs['widget'] = form.Select2Widget(multiple=True) doc_type = field.field.document_type return fields.ModelSelectMultipleField(model=doc_type, **kwargs) if field.field.choices: kwargs['multiple'] = True return self.convert(model, field.field, kwargs) unbound_field = self.convert(model, field.field, {}) kwargs = { 'validators': [], 'filters': [], } return InlineFieldList(unbound_field, min_entries=0, **kwargs)