The problem is, when field1 is chosen using the popup the change event is
not triggered, so field2 is not updated.
This is easy to fix:
{{{
--- a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
+++ b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
@@ -49,6 +49,9 @@
} else {
document.getElementById(name).value = chosenId;
}
+ var evt = document.createEvent("HTMLEvents");
+ evt.initEvent("change", false, true);
+ elem.dispatchEvent(evt);
win.close();
}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/31170>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => needsinfo
Comment:
Can you put a minimal project/page together showing this, and why you
can't attach your own listener and such?
(It's a bit difficult to see exactly what's going on just from that
diff...)
Thanks.
(I'm going to close for now as needsinfo. Please re-open when you have an
example. Thanks!)
--
Ticket URL: <https://code.djangoproject.com/ticket/31170#comment:1>