Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在 Tastypie 中实现自己的 obj_create() 时,失败的正确方法是什么(因为我知道例如超出了某些配额)?我想有一个标准的例外可以提出,但我不知道是哪一个。
通过使用(来自 Django)子类ImmediateHttpResponse之一引发异常。tastypie.http HttpResponse
ImmediateHttpResponse
tastypie.http
HttpResponse
from tastypie.exceptions import ImmediateHttpResponse from tastypie.http import HttpSeeOther ... raise ImmediateHttpResponse(HttpSeeOther())