Skip to content

Commit

Permalink
Merge pull request #75 from vxsx/bugfix/dismiss-popup-django-1.8
Browse files Browse the repository at this point in the history
Use different function name for dismissing "add" popup when necessary
  • Loading branch information
gregmuellegger committed Apr 21, 2016
2 parents 58b811a + e1ccffe commit 99a3ad6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sortedm2m/static/sortedm2m/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ if (jQuery === undefined) {
});
});

var dismissPopupFnName = 'dismissAddAnotherPopup';
// django 1.8+
if (window.dismissAddRelatedObjectPopup) {
dismissPopupFnName = 'dismissAddRelatedObjectPopup';
}

if (window.showAddAnotherPopup) {
var django_dismissAddAnotherPopup = window.dismissAddAnotherPopup;
window.dismissAddAnotherPopup = function (win, newId, newRepr) {
var django_dismissAddAnotherPopup = window[dismissPopupFnName];
window[dismissPopupFnName] = function (win, newId, newRepr) {
// newId and newRepr are expected to have previously been escaped by
// django.utils.html.escape.
newId = html_unescape(newId);
Expand Down

0 comments on commit 99a3ad6

Please sign in to comment.