aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/views.py
diff options
context:
space:
mode:
authorTom Christie2012-11-06 10:44:19 +0000
committerTom Christie2012-11-06 10:44:19 +0000
commitb19c58ae17ee54a3a8d193608660d96fd52f83f0 (patch)
treec4deae81b0f0de7083ecadce29ce5813b6411db4 /rest_framework/views.py
parent455a8cedcf5aa1f265ae95d4f3bff359d51910c0 (diff)
downloaddjango-rest-framework-b19c58ae17ee54a3a8d193608660d96fd52f83f0.tar.bz2
Support for HTML error templates. Fixes #319.
Diffstat (limited to 'rest_framework/views.py')
-rw-r--r--rest_framework/views.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/rest_framework/views.py b/rest_framework/views.py
index 71e1fe6c..1afbd697 100644
--- a/rest_framework/views.py
+++ b/rest_framework/views.py
@@ -320,13 +320,17 @@ class APIView(View):
self.headers['X-Throttle-Wait-Seconds'] = '%d' % exc.wait
if isinstance(exc, exceptions.APIException):
- return Response({'detail': exc.detail}, status=exc.status_code)
+ return Response({'detail': exc.detail},
+ status=exc.status_code,
+ exception=True)
elif isinstance(exc, Http404):
return Response({'detail': 'Not found'},
- status=status.HTTP_404_NOT_FOUND)
+ status=status.HTTP_404_NOT_FOUND,
+ exception=True)
elif isinstance(exc, PermissionDenied):
return Response({'detail': 'Permission denied'},
- status=status.HTTP_403_FORBIDDEN)
+ status=status.HTTP_403_FORBIDDEN,
+ exception=True)
raise
# Note: session based authentication is explicitly CSRF validated,