def _wrapped_view(request, *args, **kwargs): if request.user.is_authenticated(): return function(request, *args, **kwargs) return render_to_json_response({'status': {'code': 401, 'text': 'login required'}})
def _wrapped_view(request, *args, **kwargs): if request.user.is_authenticated() and request.user.get_profile().get_level() == 'admin': return function(request, *args, **kwargs) return render_to_json_response({'status': {'code': 403, 'text': 'permission denied'}})
def process_exception(self, request, exception): if isinstance(exception, HttpErrorJson): return render_to_json_response(exception.response) return None