Django returns the default HTML error template when an unhandled exception occurs in the view. I would like to return a JSON response instead if the request had the header "Accept: 'application / json" (but otherwise, normal HTML was returned). How can i do this?
source share