-
Type:
New Feature
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: django
-
None
Context
What is Django REST Framework?
Django does not ship any built-in REST API layer. Django REST Framework (DRF) is the de facto standard third-party library for building REST/JSON APIs in Django, providing serializers, viewsets, routers, authentication, and permission primitives on top of Django’s ORM and view system.
DRF is one of the most widely adopted Django extensions in production environments. Teams that build Django apps with MongoDB expect:
- First-class DRF support for their models and fields.
- Smooth integration with DRF ModelSerializer and nested serializers when working with embedded documents.
Today, our custom MongoDB field types:
- EmbeddedModelField
- EmbeddedModelArrayField
- PolymorphicEmbeddedModelField
- PolymorphicEmbeddedModelArrayField
do not have dedicated DRF field/serializer integrations. At best, they are treated as generic structures; at worst, they require ad‑hoc custom serializers per field.
Why is this valuable?
Lack of DRF support for these embedded model fields causes:
- Excess boilerplate – Users must hand‑roll DRF serializers for each embedded model and wire them manually instead of relying on DRF’s ModelSerializer field mapping.
- Adoption blocker – For teams who consider DRF non‑negotiable for their API layer, missing support for embedded fields can be a reason to avoid or roll off our Django integration altogether.
Acceptance Criteria
Determine the work necessary to support EmbeddedModelField, EmbeddedModelArrayField, PolymorphicEmbeddedModelField, and PolymorphicEmbeddedModelArrayField in Django Rest Framework. At a cursory glance, it seems likely that these fields may need a corresponding DRF serializer or field to make things work properly.
A proposal to modify EmbeddedModelField.get_db_prep_save() is likely not suitable.
Pitfalls
- We have no known solution, so ample time will need to be taken to test out a viable approach.
- depends on
-
INTPYTHON-987 [Django] Add readthedocs to the extentions repo
-
- Closed
-
-
INTPYTHON-989 [Django] Improve project infrastructure of django-mongodb-extensions
-
- Closed
-