toastdriven/django-tastypie — Issue #348: ModelResource.method_check not supplying list of allowed http methods in response header
Author: ryanisnan
Created: 2012-01-30 02:33:48+00:00
State: open

It appears that the method_check method doesn't return the list of allowed http methods when it returns a HttpResponseNotAllowed(Http 405).

Example:

class CareerResource(ModelResource):
class Meta:
queryset = Career.objects.all()
resource_name = 'career'

def override_urls(self):
return [
url(r"^(?P%s)/(?P\w[\w/-]*)/follow/$" % self._meta.resource_name, self.wrap_view('post_career_follow'), name="post_career_follow"),
]

def post_career_follow(self, request, **kwargs):
self.method_check(request, allowed=['post']) # Returns a 405 with no Allow attribute in the header
# return HttpResponseNotAllowed(['POST']) # Returns a 405 with the Allow attribute in the header