Opened 9 years ago
Last modified 9 years ago
#25142 closed Cleanup/optimization
Refactor dispatch method in PermissionRequiredMixin to allow customisation — at Initial Version
Reported by: | Akis Kesoglou | Owned by: | Akis Kesoglou |
---|---|---|---|
Component: | contrib.auth | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | akiskesoglou@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Extending from PermissionRequiredMixin to implement a mixin for checking for *object* permissions means that you can't call super in .dispatch because PermissionRequiredMixin will do another check for model-level permissions.
I propose to delegate the check for permissions in PermissionRequiredMixin.dispatch to an instance method. This way, we are able to provide a hook for code to check for object permissions without having to re-implement the whole class.
PR coming shortly.
Note:
See TracTickets
for help on using tickets.