#36284: Related lookup popup doesn't close after selecting an existing item
--------------------------------------+------------------------------------
     Reporter:  Matthias Kestenholz   |                    Owner:  (none)
         Type:  Bug                   |                   Status:  new
    Component:  contrib.admin         |                  Version:  5.2
     Severity:  Release blocker       |               Resolution:
     Keywords:  RelatedObjectLookups  |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  1
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Comment (by Natalia Bidart):

 Matthias, if you are already able to run the JS tests (I'm setting my env
 up), could you verify if this solution fixes the issue? My point being: I
 know the
 django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js does
 fix this bug report, but I wonder if, without this change, the test
 properly fails if `window.relatedWindows` is not defined as it's now.
 Basically my goal is to ensure that the test does not rely on a fabricated
 `window.relatedWindows`. Does this make sense?
 {{{#!diff
 diff --git
 a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
 b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
 index 5395386087..d6ce297981 100644
 --- a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
 +++ b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
 @@ -206,6 +206,7 @@
      window.dismissChangeRelatedObjectPopup =
 dismissChangeRelatedObjectPopup;
      window.dismissDeleteRelatedObjectPopup =
 dismissDeleteRelatedObjectPopup;
      window.dismissChildPopups = dismissChildPopups;
 +    window.relatedWindows = relatedWindows

      // Kept for backward compatibility
      window.showAddAnotherPopup = showRelatedObjectPopup;
 diff --git a/js_tests/admin/RelatedObjectLookups.test.js
 b/js_tests/admin/RelatedObjectLookups.test.js
 index 722aa7ae7b..0d71d88f2a 100644
 --- a/js_tests/admin/RelatedObjectLookups.test.js
 +++ b/js_tests/admin/RelatedObjectLookups.test.js
 @@ -8,7 +8,6 @@ QUnit.module('admin.RelatedObjectLookups', {
              <input type="text" id="test_id" name="test" />
              <input type="text" id="many_test_id" name="many_test"
 class="vManyToManyRawIdAdminField" />
          `);
 -        window.relatedWindows = window.relatedWindows || [];
      }
  });

  }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36284#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070195f1e52eb4-207d4dc3-0b92-4521-9f83-c2bc0753dcf3-000000%40eu-central-1.amazonses.com.

Reply via email to