我正在使用 django-tastypie 和骨干的组合。
我正在尝试做一个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()