Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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 jacobian authored
Showing with 13 additions and 5 deletions.
  1. +13 −5 django/contrib/admin/media/js/admin/RelatedObjectLookups.js
18 django/contrib/admin/media/js/admin/RelatedObjectLookups.js
View
@@ -29,12 +29,20 @@ function showAddAnotherPopup(triggeringLink) {
function dismissAddAnotherPopup(win, newId, newRepr) {
var name = win.name.replace(/___/g, '.')
var elem = document.getElementById(name);
- if (elem.nodeName == 'SELECT') {
+ if (elem) {
+ if (elem.nodeName == 'SELECT') {
+ var o = new Option(newRepr, newId);
+ elem.options[elem.options.length] = o
+ elem.selectedIndex = elem.length - 1;
+ } else if (elem.nodeName == 'INPUT') {
+ elem.value = newId;
+ }
+ } else {
+ var toId = name + "_to";
+ elem = document.getElementById(toId);
var o = new Option(newRepr, newId);
- elem.options[elem.options.length] = o
- elem.selectedIndex = elem.length - 1;
- } else if (elem.nodeName == 'INPUT') {
- elem.value = newId;
+ SelectBox.add_to_cache(toId, o);
+ SelectBox.redisplay(toId);
}
win.close();
}
Please sign in to comment.
Something went wrong with that request. Please try again.