mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[4.1.x] Fixed #34025 -- Fixed selecting ModelAdmin.autocomplete_fields after adding/changing related instances via popups.
Regression inc72f6f36c1. Thanks Alexandre da Silva for the report. Backport of9976f3d4b8from main
This commit is contained in:
committed by
Mariusz Felisiak
parent
4f7fc378a1
commit
33d9247c8b
@@ -96,7 +96,8 @@
|
||||
// Extract the model from the popup url '.../<model>/add/' or
|
||||
// '.../<model>/<id>/change/' depending the action (add or change).
|
||||
const modelName = path.split('/')[path.split('/').length - (objId ? 4 : 3)];
|
||||
const selectsRelated = document.querySelectorAll(`[data-model-ref="${modelName}"] select`);
|
||||
// Exclude autocomplete selects.
|
||||
const selectsRelated = document.querySelectorAll(`[data-model-ref="${modelName}"] select:not(.admin-autocomplete)`);
|
||||
|
||||
selectsRelated.forEach(function(select) {
|
||||
if (currentSelect === select) {
|
||||
|
||||
Reference in New Issue
Block a user