Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tastypie:根据请求方法定向重写的URL_Python_Django_Tastypie - Fatal编程技术网

Python Tastypie:根据请求方法定向重写的URL

Python Tastypie:根据请求方法定向重写的URL,python,django,tastypie,Python,Django,Tastypie,我使用的是一个有问题的URL,我们称之为/user/{id}/bucket/ 我想使用/user/{id}/bucket/重定向到dispatch\u list,但使用POST重定向到我自己的视图(处理bucket)进行处理 我知道urlconfs不支持任何检查请求方法的方法,所以我应该如何做呢?您可以简单地覆盖资源的分派方法,以执行任何您想要的操作 class FooResource(ModelResource): class Meta: # The usual stu

我使用的是一个有问题的URL,我们称之为
/user/{id}/bucket/

我想使用
/user/{id}/bucket/
重定向到
dispatch\u list
,但使用
POST
重定向到我自己的视图
(处理bucket)
进行处理


我知道urlconfs不支持任何检查请求方法的方法,所以我应该如何做呢?

您可以简单地覆盖资源的分派方法,以执行任何您想要的操作

class FooResource(ModelResource):
    class Meta:
        # The usual stuff

    def dispatch(self, request_type, request, **kwargs):
        # Do whatever