[Fixed]-Passing a cause description to a 403 handler view

1👍

Looks like you would have to implement this using a middleware:

class ExceptionMiddleware:
    def process_exception(self, request, exception):
        if exception.args:
            request.message = exception.args[0]

Then in your handler403 you could access request.message.

Obviously you could flesh-out this middleware to allow passing more than just a message to the view.

👤dgel

Leave a comment