我想做以下事情:
raise HttpResponseForbidden()
但我得到了错误:
exceptions must be old-style classes or derived from BaseException, not HttpResponseForbidden
我该怎么做?
像其他任何响应一样从视图中返回它。
from django.http import HttpResponseForbidden return HttpResponseForbidden()