{"id":23595,"library":"django-rest-multiple-models","title":"Django REST Multiple Models","description":"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.","status":"active","version":"2.1.3","language":"python","source_language":"en","source_url":"https://github.com/Axiologue/DjangoRestMultipleModels","tags":["django-rest-framework","multiple-models","api","queryset"],"install":[{"cmd":"pip install django-rest-multiple-models","lang":"bash","label":"Latest stable release"}],"dependencies":[{"reason":"Core framework dependency.","package":"django","optional":false},{"reason":"Required for the view and mixin.","package":"djangorestframework","optional":false}],"imports":[{"note":"","wrong":"","symbol":"MultipleModelMixin","correct":"from drf_multiple_model.views import MultipleModelMixin"},{"note":"","wrong":"","symbol":"MultipleModelViewSetMixin","correct":"from drf_multiple_model.views import MultipleModelViewSetMixin"},{"note":"The old name MultipleModelAPIView was removed in 2.0.","wrong":"from drf_multiple_model.views import MultipleModelAPIView","symbol":"ObjectMultipleModelAPIView","correct":"from drf_multiple_model.views import ObjectMultipleModelAPIView"},{"note":"","wrong":"","symbol":"FlatMultipleModelAPIView","correct":"from drf_multiple_model.views import FlatMultipleModelAPIView"}],"quickstart":{"code":"# views.py\nfrom drf_multiple_model.views import ObjectMultipleModelAPIView\nfrom .models import Author, Book\nfrom .serializers import AuthorSerializer, BookSerializer\n\nclass MixedAPIView(ObjectMultipleModelAPIView):\n    querylist = [\n        {'queryset': Author.objects.all(), 'serializer_class': AuthorSerializer},\n        {'queryset': Book.objects.all(), 'serializer_class': BookSerializer, 'label': 'books'},\n    ]\n    # Optional: sorting, pagination, etc.","lang":"python","description":"Define a view that returns multiple querysets grouped by label or flat."},"warnings":[{"fix":"Replace 'MultipleModelAPIView' with 'ObjectMultipleModelAPIView'. See changelog for full migration.","message":"v2.0 renamed MultipleModelAPIView to ObjectMultipleModelAPIView, and removed the old mixin-based API. Update imports accordingly.","severity":"breaking","affected_versions":"1.x -> 2.x"},{"fix":"Set 'pagination' inside each querylist dict (or use class-level 'pagination'). See docs.","message":"Pagination in v2.0 changed from a global setting to a per-querylist attribute. The old 'pagination_count' attribute is removed.","severity":"breaking","affected_versions":"1.x -> 2.x"},{"fix":"Use 'FlatMultipleModelAPIView' when a flat list is desired.","message":"The 'flat' property (FlatMultipleModelAPIView) returns all items in a single list. Without 'flat', each label is a key with a list. Ensure client expectations match.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install django-rest-multiple-models' and verify installation.","cause":"Package not installed or installed under a different name.","error":"ModuleNotFoundError: No module named 'drf_multiple_model'"},{"fix":"Use 'ObjectMultipleModelAPIView' instead.","cause":"Upgraded from v1.x to v2.x without updating import.","error":"AttributeError: module 'drf_multiple_model.views' has no attribute 'MultipleModelAPIView'"},{"fix":"Ensure each dict contains 'queryset' and 'serializer_class'.","cause":"Missing required keys in querylist dict.","error":"ImproperlyConfigured: Each item in querylist must have 'queryset' and 'serializer_class' keys."},{"fix":"Set 'sort_fn' or 'sort_field' on the view when using 'sort_url_param'.","cause":"Trying to use sorting without defining sorting logic.","error":"AssertionError: Expected view to have attribute 'sort_fn' or 'sort_field' if 'sort_url_param' is set."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}