Mixins

Mixins#

DRF view mixins implementing the Open edX REST API conventions, currently StandardizedErrorMixin — the per-view opt-in for the ADR 0029 standardized error-response handler.

class StandardizedErrorMixin#

Opt-in mixin that routes DRF exceptions on this view through the ADR 0029 standardized error-response handler (edx_rest_framework_extensions.errors.standardized_error_exception_handler()).

DRF’s rest_framework.views.APIView calls self.get_exception_handler inside handle_exception; overriding that method here lets the view return the standardized envelope while other endpoints continue to use whichever handler the project-wide EXCEPTION_HANDLER setting points at.

Usage:

class MyViewSet(StandardizedErrorMixin, viewsets.ViewSet):
    ...