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.
我正在处理一个有问题的 URL,我们称之为/user/{id}/buckets/
/user/{id}/buckets/
我想要一个 GET/user/{id}/buckets/来重定向到dispatch_list但一个POST重定向到我自己的视图(process_buckets)进行处理。
dispatch_list
POST
(process_buckets)
我知道 urlconfs 不支持任何方式来检查请求方法,那么我应该怎么做呢?
你可以简单地覆盖资源的调度方法来做任何你想做的事情
class FooResource(ModelResource): class Meta: # The usual stuff def dispatch(self, request_type, request, **kwargs): # Do whatever