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
Source:stackexchange.com