Code

Ticket #5704: 5704trunk.diff

File 5704trunk.diff, 1.9 KB (added by mb0@…, 6 years ago)

patched with minimal valid xhml structure, javascript elem.nodeName happens to be lowercase

Line 
1Index: django/contrib/admin/media/js/admin/RelatedObjectLookups.js
2===================================================================
3--- django/contrib/admin/media/js/admin/RelatedObjectLookups.js (revision 7227)
4+++ django/contrib/admin/media/js/admin/RelatedObjectLookups.js (working copy)
5@@ -59,11 +59,12 @@
6     var name = win.name.replace(/___/g, '.');
7     var elem = document.getElementById(name);
8     if (elem) {
9-        if (elem.nodeName == 'SELECT') {
10+        var elemName = elem.nodeName.toUpperCase();
11+        if (elemName == 'SELECT') {
12             var o = new Option(newRepr, newId);
13             elem.options[elem.options.length] = o;
14             o.selected = true;
15-        } else if (elem.nodeName == 'INPUT') {
16+        } else if (elemName == 'INPUT') {
17             elem.value = newId;
18         }
19     } else {
20Index: django/contrib/admin/views/main.py
21===================================================================
22--- django/contrib/admin/views/main.py  (revision 7227)
23+++ django/contrib/admin/views/main.py  (working copy)
24@@ -273,7 +273,9 @@
25                     post_url_continue += "?_popup=1"
26                 return HttpResponseRedirect(post_url_continue % pk_value)
27             if "_popup" in request.POST:
28-                return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, "%s", "%s");</script>' % \
29+                return HttpResponse('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
30+                    '<html xmlns="http://www.w3.org/1999/xhtml"><head><title></title></head><body>'
31+                    '<script type="text/javascript">opener.dismissAddAnotherPopup(window, "%s", "%s");</script></body></html>' % \
32                     # escape() calls force_unicode.
33                     (escape(pk_value), escape(new_object)))
34             elif "_addanother" in request.POST: