Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #348 -- Fixed bug in admin JavaScript filter interface. Thanks …

…for the patch, Gary Wilson

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6015 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 70740d6eca8c4b439a95d17ef41e2229b2b8f399 1 parent 132605d
Adrian Holovaty authored
12  django/contrib/admin/media/js/SelectBox.js
@@ -6,7 +6,7 @@ var SelectBox = {
6 6
         SelectBox.cache[id] = new Array();
7 7
         var cache = SelectBox.cache[id];
8 8
         for (var i = 0; (node = box.options[i]); i++) {
9  
-            cache.push({ value: node.value, text: node.text, displayed: 1 });
  9
+            cache.push({value: node.value, text: node.text, displayed: 1});
10 10
         }
11 11
     },
12 12
     redisplay: function(id) {
@@ -50,7 +50,7 @@ var SelectBox = {
50 50
         SelectBox.cache[id].length--;
51 51
     },
52 52
     add_to_cache: function(id, option) {
53  
-        SelectBox.cache[id].push({ value: option.value, text: option.text, displayed: 1 });
  53
+        SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1});
54 54
     },
55 55
     cache_contains: function(id, value) {
56 56
         // Check if an item is contained in the cache
@@ -68,7 +68,7 @@ var SelectBox = {
68 68
         var option;
69 69
         for (var i = 0; (option = from_box.options[i]); i++) {
70 70
             if (option.selected && SelectBox.cache_contains(from, option.value)) {
71  
-                SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
  71
+                SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1});
72 72
                 SelectBox.delete_from_cache(from, option.value);
73 73
             }
74 74
         }
@@ -80,8 +80,10 @@ var SelectBox = {
80 80
         var to_box = document.getElementById(to);
81 81
         var option;
82 82
         for (var i = 0; (option = from_box.options[i]); i++) {
83  
-            SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
84  
-            SelectBox.delete_from_cache(from, option.value);
  83
+            if (SelectBox.cache_contains(from, option.value)) {
  84
+                SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1});
  85
+                SelectBox.delete_from_cache(from, option.value);
  86
+            }
85 87
         }
86 88
         SelectBox.redisplay(from);
87 89
         SelectBox.redisplay(to);

0 notes on commit 70740d6

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