Code

Ticket #1635: django_1635.diff

File django_1635.diff, 1.1 KB (added by Christopher Lenz <cmlenz@…>, 8 years ago)

Patch that fixes the issue by replacing every period with a triple underscore

Line 
1Index: django/contrib/admin/media/js/admin/RelatedObjectLookups.js
2===================================================================
3--- django/contrib/admin/media/js/admin/RelatedObjectLookups.js (revision 2696)
4+++ django/contrib/admin/media/js/admin/RelatedObjectLookups.js (working copy)
5@@ -2,7 +2,8 @@
6 // and Add Another links.
7 
8 function showRelatedObjectLookupPopup(triggeringLink) {
9-    var name = triggeringLink.id.replace(/^lookup_/, '');
10+    var name = triggeringLink.id.replace(/^lookup_/, '');
11+    name = name.replace(/\./g, '___');
12     var href;
13     if (triggeringLink.href.search(/\?/) >= 0) {
14         href = triggeringLink.href + '&pop=1';
15@@ -15,11 +16,12 @@
16 }
17 
18 function dismissRelatedLookupPopup(win, chosenId) {
19-    var elem = document.getElementById(win.name);
20+    var name = win.name.replace(/___/g, '.');
21+    var elem = document.getElementById(name);
22     if (elem.className.indexOf('vRawIdAdminField') != -1 && elem.value) {
23         elem.value += ',' + chosenId;
24     } else {
25-        document.getElementById(win.name).value = chosenId;
26+        document.getElementById(name).value = chosenId;
27     }
28     win.close();
29 }