Opened 3 years ago

Closed 3 years ago

#32771 closed Cleanup/optimization (fixed)

Hardcoded _popup values should use IS_POPUP_VAR instead

Reported by: David Sanders Owned by: nobody
Component: contrib.admin Version: 3.2
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

Description

There's a handful of places in the codebase which hardcode the '_popup' string rather than using the IS_POPUP_VAR constant. They should all use IS_POPUP_VAR for consistency.

I've got a PR to fix all occurrences other than two cases in the admin JavaScript, since there's not a clear fix there. Possible solutions for JavaScript would be to add it into the base admin template and pull it back out in the code that needs it, or hardcode it in a single spot in the JavaScript on window. Neither solution feels great to me, so I'm kicking the can down the road on the JavaScript occurrences.

Change History (3)

comment:1 by Mariusz Felisiak, 3 years ago

Triage Stage: UnreviewedAccepted

I couldn't find many places where '_popup' is used instead of IS_POPUP_VAR (except tests) but I'd be happy to review a patch.

comment:2 by David Sanders, 3 years ago

@Mariusz, yea, outside of tests it's only used in two templates, and two JavaScript files. I've just spent a lot of time in the django.contrib.admin code in the last month so I've got a list of PRs I'm checking off for cleanup/optimization of things I noted while in the code. There's a PR for this on GitHub now.

comment:3 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: newclosed

In 2978c63:

Fixed #32771 -- Used IS_POPUP_VAR constant instead of hard-coded value.

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