diff options
| author | David Sanders <shang.xiao.sanders@gmail.com> | 2022-09-21 22:56:22 +1000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-09-28 12:54:48 +0200 |
| commit | 33d9247c8b8be89518158c19b48a85a8c2d649c5 (patch) | |
| tree | 638e842681231cb5eadea2a328a8c32704973202 /django | |
| parent | 4f7fc378a1be02643b909bf013bac17d43b91538 (diff) | |
[4.1.x] Fixed #34025 -- Fixed selecting ModelAdmin.autocomplete_fields after adding/changing related instances via popups.
Regression in c72f6f36c13a21f6db3d4f85d2d3cec87bad45e6.
Thanks Alexandre da Silva for the report.
Backport of 9976f3d4b80cfb2e6f4c998438622b78eb1ac53e from main
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js index 5c9c0d833d..752dcad7bf 100644 --- a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js +++ b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js @@ -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) { |
