Model Serializer that supports MongoEngine, for Django Rest Framework.
# model
class Blog(Document):
owner = ReferenceField(User)
title = StringField()
extensions = ListField(EmbeddedDocument(BlogExtension))
tags = ListField(StringField())
approved = BooleanField()
# serializer
class BlogSerializer(MongoEngineModelSerializer):
class Meta:
model = Blog
depth = 2
exclude = ('approved', )
Notes:
- MongoEngine Model Serializer also supports DynamicDocument.
Depth
is optional and defaults to 5. It is used for ReferenceField & ListField.
pip install django-rest-framework-mongoengine
See LICENSE