Mongoengine support for Django Rest Framework.
Starting from version 2.0
, this package will be developed using DRF 3.0
and higher.
If you want to use DRFME
with DRF 2
, you should version 1.*
. Development will be continued on drf_2_support
branch.
pip install django-rest-framework-mongoengine
Don't forget to add the package to installed apps.
INSTALLED_APPS = (
...
'rest_framework_mongoengine',
)
See full documentation here
DocumentSerializer
works just like as DRF Model Serializer
. Your model fields are converted to relevant serializer fields automatically. If you want custom behavior, you can use nested serializers
.
EmbeddedDocumentSerializer
is used to customize EmbeddedDocument
behavior, and make validations
accurately. It is mentioned extensively on the documentation
Generic Views
are named exactly the same as DRF Generic Views
.
Just make sure you are using DRFME Generics
.
from rest_framework_mongoengine import generics