Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Added a logging call on HTTP 405 for class-based views. This is for c…

…onsistency with function-based views.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent e118230 commit 3ecc84a83c7204778e3d3f7dde5e669ac63906e7 @freakboy3742 freakboy3742 committed
Showing with 7 additions and 1 deletion.
  1. +7 −1 django/views/generic/
8 django/views/generic/
@@ -60,7 +60,7 @@ def view(request, *args, **kwargs):
return view
def dispatch(self, request, *args, **kwargs):
- # Try to dispatch to the right method for that; if it doesn't exist,
+ # Try to dispatch to the right method; if a method doesn't exist,
# defer to the error handler. Also defer to the error handler if the
# request method isn't on the approved list.
if request.method.lower() in self.http_method_names:
@@ -74,6 +74,12 @@ def dispatch(self, request, *args, **kwargs):
def http_method_not_allowed(self, request, *args, **kwargs):
allowed_methods = [m for m in self.http_method_names if hasattr(self, m)]
+ logger.warning('Method Not Allowed (%s): %s' % (request.method, request.path),
+ extra={
+ 'status_code': 405,
+ 'request': self.request
+ }
+ )
return http.HttpResponseNotAllowed(allowed_methods)

0 comments on commit 3ecc84a

Please sign in to comment.
Something went wrong with that request. Please try again.