#35237: Improve
------------------------------------------------+--------------------------
Reporter: Adam Johnson | Owner: nobody
Type: Cleanup/optimization | Status: assigned
Component: Core (System checks) | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+--------------------------
In `ModelAdminChecks`, the `_check_action_permission_methods` and
`_check_actions_uniqueness` both fetch the actions. By combining them,
this duplicate work can be eliminated.
Additionally, the lower method `ModelAdmin._get_action_description()` is
wasteful as it computes a default name even when one is defined. This can
be deferred and cached.
In a project I’ve profiled, these changes take the admin action checks
from 0.86ms (2.1%) to 0.36ms (0.9%).
--
Ticket URL: <
https://code.djangoproject.com/ticket/35237>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.