Opened 4 years ago

Closed 4 years ago

#23287 closed Cleanup/optimization (fixed)

Change exception message for django.utils.decorators.classonlymethod

Reported by: Peter Zsoldos Owned by: Tim Graham
Component: Utilities Version:
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The exception message when invoking it on an instance is (at the time of opening) is "This method is available only on the view class."

However, there isn't anything about this decorator that is CBV specific, and it is located in the generic django.utils module.

I propose to change the exception message to some variant of "This method is available only on the class, not on instances."

(It came up in a pull request discussion with @timgraham -

Change History (2)

comment:1 Changed 4 years ago by Tim Graham

Component: UncategorizedUtilities
Owner: changed from nobody to Tim Graham
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 Changed 4 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 64bb122c3dede3538294bab07d5f1a1980713d31:

Fixed #23287 -- Updated error message for classonlymethod decorator.

Note: See TracTickets for help on using tickets.
Back to Top