I’m using a combination of django-tastypie & backbone.
I’m trying to do a DELETE but I get a 301 Moved Permanently response.
Here’s the message from 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/
My code is below:
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()
I was missing a trailing slash. 127.0.0.1:8000/api/1/grocery_item/2/ works.