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