From d38cb8350cbf98873e9672806bcd62a6b3e51fb7 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Mon, 27 Sep 2021 19:41:50 +0500 Subject: [PATCH] Fixing django32 pop-up closing issue. (#191) * fix: django32 has removed `windowname_to_id` function but it is breaking sorted-m2m usage on pop-up. --- sortedm2m/static/sortedm2m/widget.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sortedm2m/static/sortedm2m/widget.js b/sortedm2m/static/sortedm2m/widget.js index fc922a6b..aacbdf52 100644 --- a/sortedm2m/static/sortedm2m/widget.js +++ b/sortedm2m/static/sortedm2m/widget.js @@ -108,6 +108,13 @@ if (typeof jQuery === 'undefined') { return text; } + function windowname_to_id(text) { + // django32 has removed windowname_to_id function. + text = text.replace(/__dot__/g, '.'); + text = text.replace(/__dash__/g, '-'); + return text; + } + if (window.showAddAnotherPopup) { var django_dismissAddAnotherPopup = window[dismissPopupFnName]; window[dismissPopupFnName] = function (win, newId, newRepr) {