Add contextual messages to authorization errors raised in graphs/views.py.
@@ -341,6 +341,9 @@ class CSVPageViews(_CSVDownloadView):
def dispatch(self, request, *args, **kwargs):
if request.user.is_staff:
return super(CSVPageViews, self).dispatch(request, *args, **kwargs)
+ else:
+ messages.add_message (request, messages.WARNING,
+ _('You must be staff to do that.'))
raise PermissionDenied
@@ -364,6 +367,9 @@ class CSVPageViewsByPath(_CSVDownloadView):
if request.user.is_staff:
return super(CSVPageViewsByPath, self).dispatch(
request, *args, **kwargs)
+ else:
+ messages.add_message (request, messages.WARNING,
+ _('You must be staff to do that.'))
raise PermissionDenied
