2012-04-20 46 views
1

我使用的是骨干组合django-tastypie &。骨干与TastyPie:DELETE做重定向

我试图做一个DELETE,但我得到一个301 Moved Permanently响应。

下面是Firebug的消息:

DELETE http://127.0.0.1:8000/api/1/grocery_item/2 301 Moved Permanently. 
GET http://127.0.0.1:8000/api/1/grocery_item/ 

我的代码如下:

class GroceryListItemResource(ModelResource): 

    grocery_list = fields.ForeignKey(GroceryListResource, 'grocery_list', full=True) 
    grocery_item = fields.ForeignKey(GroceryItemResource, 'grocery_item', full=True) 

    class Meta: 
     queryset = GroceryListItem.objects.all() 
     resource_name = 'list_items' 
     allowed_methods = ['get', 'post', 'delete'] 
     include_resource_uri = False 
     excludes = ['created_at', 'updated_at'] 
     filtering = { 
      'grocery_list': ALL 
     } 
     authorization= Authorization() 

回答

3

我错过了一个斜杠。 127.0.0.1:8000/api/1/grocery_item/2/的作品。

1

望着删除代码,实在没有理由应该返回一个302会发生什么事,当你通过CURL提出请求? Firefox是否有可能以某种方式拦截并更改请求?您是否看到它在您的服务器进程中作为该URL的DELETE请求?