Allows for automatic serialization of Djongo fields w/ Django REST
Project description
rest-meets-djongo
A package which enables serialization of Djongo fields with django-rest-framework's (DRF) serializers and viewsets
Features
NOTE: This repo is currently under development, and most (if not all) of its features are likely to throw errors or behave in unexpected ways; use at your own risk
Similiar to DRF ModelSerializers, creating serializers using DjongoModelSerializer allows for the following fields to be detected and managed through DRF's serializer setup. These fields include Djongo's:
- ObjectIDField
- EmbeddedModelField (both as a standalone field and as a custom built serializer)
- ArrayModelField
- ArrayReferenceField
Usage
-
Install rest-meets-djongo:
pip install rest_meets_djongo
-
Into settings.py file of your project, add:
INSTALLED_APPS = [ ... 'rest_meets_djongo', ]
- Replace REST's 'ModelSerializer' with 'DjongoModelSerializer' and enjoy the automation of EmbeddedModels and ObjectID fields!
Requirements:
(Earlier version testing is currently being testing; these are just the confirmed functional versions)
- Python 3.6 or higher
- MongoDB 4.0 or higher
- djangorestframework 3.9 or higher
- djongo 1.2 or higher
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.