ListField(EmbeddedModelField(...)) is not supported by

Issue #202 new
created an issue

A model with some_field = ListField (EmbeddedModelField('MyModel')) is not supported by The method Emitter._model just doesn't expect that inst can be a list. I have used a workaround in 5 lines to fix this problem in my project (see line 193 in



            # try to get the remainder of fields
            for maybe_field in get_fields:

                if isinstance(maybe_field, (list, tuple)):
                    model, fields = maybe_field
                    inst = getattr(data, model, None)

                    if inst:
                        if hasattr(inst, 'all'):
                            ret[model] = _related(inst, fields)
                        elif callable(inst):
                            if len(inspect.getargspec(inst)[0]) == 1:
                                ret[model] = _any(inst(), fields)
  • elif isinstance(inst, list):
  • items = []
  • for item in inst:
  • items.append(_model(item, fields))
  • ret[model] = items else: ret[model] = _model(inst[0], fields) }}}

repo: 4775806686f844ea128e3b238d73b279dc455429 node: 6b0364d98837b6b19b028d29f10769efbbcae435

Comments (1)

  1. Log in to comment