Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #1404 (thanks, Tom Tobin)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2413 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 3723f8379887a3f47d70ca1e8b743154d62beac0 1 parent 2502813
Jacob Kaplan-Moss authored
18  django/contrib/admin/media/js/admin/RelatedObjectLookups.js
@@ -29,12 +29,20 @@ function showAddAnotherPopup(triggeringLink) {
29 29
 function dismissAddAnotherPopup(win, newId, newRepr) {
30 30
     var name = win.name.replace(/___/g, '.')
31 31
     var elem = document.getElementById(name);
32  
-    if (elem.nodeName == 'SELECT') {
  32
+    if (elem) {
  33
+        if (elem.nodeName == 'SELECT') {
  34
+            var o = new Option(newRepr, newId);
  35
+            elem.options[elem.options.length] = o
  36
+            elem.selectedIndex = elem.length - 1;
  37
+        } else if (elem.nodeName == 'INPUT') {
  38
+            elem.value = newId;
  39
+        }
  40
+    } else {
  41
+        var toId = name + "_to";
  42
+        elem = document.getElementById(toId);
33 43
         var o = new Option(newRepr, newId);
34  
-        elem.options[elem.options.length] = o
35  
-        elem.selectedIndex = elem.length - 1;
36  
-    } else if (elem.nodeName == 'INPUT') {
37  
-        elem.value = newId;
  44
+        SelectBox.add_to_cache(toId, o);
  45
+        SelectBox.redisplay(toId);
38 46
     }
39 47
     win.close();
40 48
 }

0 notes on commit 3723f83

Please sign in to comment.
Something went wrong with that request. Please try again.