Skip to content

2.0.0

Compare
Choose a tag to compare
@OdinsPlasmaRifle OdinsPlasmaRifle released this 29 Jun 21:30
· 22 commits to master since this release

Enhancements

Major changes to how view response serialization and status codes are retrieved.

Response serialization

Instead of specifying a return_serializer within the create/update methods on the view, the response serializer can be specified using a new format in the serializer_classes attribute on views. The new format allows a separate request and response to be defined:

serializer_classes = {"GET": (RequestObjectSerializer, ResponseObjectSerializer,)}

The old format where it defaults to to the same serializer for both request and response serialization is still supported:

serializer_classes = {"GET": RequestAndResponseObjectSerializer}

Response status codes

Response status codes can now be modified via the response_status_codes attribute on views instead of the old return_status_code. Status codes can be specified for each HTTP method:

response_status_codes = {"GET": status.HTTP_200_OK}