Djangorestframework Inclusions 1.2.0

djangorestframework-inclusions 1.2.0

Last updated:

0 purchases

djangorestframework-inclusions 1.2.0 Image
djangorestframework-inclusions 1.2.0 Images

Free

Languages

Categories

Add to Cart

Description:

djangorestframeworkinclusions 1.2.0

DRF-inclusions
A django-restframework renderer to side-load related resources.





One drawback of RESTful APIs is that you have to make many calls to fetch all
the related resources. DRF-inclusions provides a custom renderer allowing you
to sideload those in a single, original request.
DRF-inclusions allows you to specify which serializers to use for included
resources, and via the query string the client can specify which resources
should be included.
Features:

arbitrary depth
option to include all related resources
de-duplication when the same object is found in multiple parent/related
objects
an effort is made to retrieve related objects in as little DB queries as possible

Installation
pip install djangorestframework-inclusions

Usage
from rest_framework_inclusions.renderer import InclusionJSONRenderer


class MySerializer(...):
inclusion_serializers = {"some_field": OtherSerializer}


class MyViewSet(...):
...
renderer_classes = (InclusionJSONRenderer,)

See the tests and testapp for advanced usage examples.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.