umutbozkurt/django-rest-framework-mongoengine — pull request #4 by jczulian (2014-05-28 10:15:27+00:00)
Title: BaseDocument should be added to the list of iterable to ignore

A Mongoengine BaseDocument is also __iter__'able and therefore should be added to the list of iterable to be ignored.

The problem seems that a MongoEngine BaseDocument implement __iter__ and therefore is considered by the rest_framework serializer as if we gave to it a list (or queryset) of Documents. In my case the code was then breaking and throwing exception in the to_native method.

By adding BaseDocument to the list of iterable to be ignored it all work fine.

I am really surprised that this problem was not encountered before and I am thinking that I might have done something wrong in order to come across this problem. Note also that I am running on python 2.7.