Code

Ticket #5704: 5704nfa.diff

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

same for newforms-admin

Line 
1Index: django/contrib/admin/media/js/admin/RelatedObjectLookups.js
2===================================================================
3--- django/contrib/admin/media/js/admin/RelatedObjectLookups.js (revision 7189)
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/options.py
21===================================================================
22--- django/contrib/admin/options.py     (revision 7195)
23+++ django/contrib/admin/options.py     (working copy)
24@@ -381,7 +381,9 @@
25                 post_url_continue += "?_popup=1"
26             return HttpResponseRedirect(post_url_continue % pk_value)
27         if request.POST.has_key("_popup"):
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 request.POST.has_key("_addanother"):