Registry / web-framework / django-rest-multiple-models

django-rest-multiple-models

JSON →
library2.1.3pypypiunverified

Provides a generic view (and mixin) for returning multiple models or querysets from a single Django REST Framework endpoint. Current version 2.1.3. Maintenance appears sporadic.

pip install django-rest-multiple-models
INSTALL
IMPORT
SIG · DJANGO-REST-MULTIP
D
django-rest-multiple-models
web-frameworkpythonv2.1.3
Install
1.5s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MultipleModelMixin
✓ from drf_multiple_model import MultipleModelMixin
✗ from drf_multiple_model.views import MultipleModelMixin
MultipleModelViewSet
✓ from drf_multiple_model import MultipleModelViewSet
VERSION
✓ from drf_multiple_model import VERSION

Define a view that returns multiple querysets grouped by label or flat.

# views.py from drf_multiple_model.views import ObjectMultipleModelAPIView from .models import Author, Book from .serializers import AuthorSerializer, BookSerializer class MixedAPIView(ObjectMultipleModelAPIView): querylist = [ {'queryset': Author.objects.all(), 'serializer_class': AuthorSerializer}, {'queryset': Book.objects.all(), 'serializer_class': BookSerializer, 'label': 'books'}, ] # Optional: sorting, pagination, etc.
Debug
Known issues
breakingv2.0 renamed MultipleModelAPIView to ObjectMultipleModelAPIView, and removed the old mixin-based API. Update imports accordingly.
fix
Replace 'MultipleModelAPIView' with 'ObjectMultipleModelAPIView'. See changelog for full migration.
affects: 1.x -> 2.x
breakingPagination in v2.0 changed from a global setting to a per-querylist attribute. The old 'pagination_count' attribute is removed.
fix
Set 'pagination' inside each querylist dict (or use class-level 'pagination'). See docs.
affects: 1.x -> 2.x
gotchaThe 'flat' property (FlatMultipleModelAPIView) returns all items in a single list. Without 'flat', each label is a key with a list. Ensure client expectations match.
fix
Use 'FlatMultipleModelAPIView' when a flat list is desired.
affects: All
Upgrade
Version history
2.1.3latest on PyPI · released Dec 1, 2018
Audit
Dependencies
djangorequiredCore framework dependency.
djangorestframeworkrequiredRequired for the view and mixin.
Agent activity
15 hits · last 30 days
node
14
Resources
django-rest-multiple-models — pip install django-rest-multiple-models · libregistry