From 96c6f9c61c62af8e2e258642b21351484e61b644 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Fri, 10 Apr 2020 17:00:22 +0200 Subject: [PATCH] Fixed #31441 -- Ensured TabluarInline expands when child inputs have errors. --- .../contrib/admin/static/admin/js/collapse.js | 2 +- .../admin/static/admin/js/collapse.min.js | 2 +- tests/admin_inlines/tests.py | 41 +++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/django/contrib/admin/static/admin/js/collapse.js b/django/contrib/admin/static/admin/js/collapse.js index c40dcc2ee1..3f012a5b47 100644 --- a/django/contrib/admin/static/admin/js/collapse.js +++ b/django/contrib/admin/static/admin/js/collapse.js @@ -17,7 +17,7 @@ for (var i = 0; i < fieldsets.length; i++) { var elem = fieldsets[i]; // Don't hide if fields in this fieldset have errors - if (elem.querySelectorAll('div.errors').length === 0) { + if (elem.querySelectorAll('div.errors, ul.errorlist').length === 0) { elem.classList.add('collapsed'); var h2 = elem.querySelector('h2'); var link = document.createElement('a'); diff --git a/django/contrib/admin/static/admin/js/collapse.min.js b/django/contrib/admin/static/admin/js/collapse.min.js index 03f74e7f5a..33a93573bd 100644 --- a/django/contrib/admin/static/admin/js/collapse.min.js +++ b/django/contrib/admin/static/admin/js/collapse.min.js @@ -1,3 +1,3 @@ -(function(){var e=function(b,a){return b.nodeName===a.toUpperCase()?b:"BODY"===b.parentNode.nodeName?null:b.parentNode&&e(b.parentNode,a)};window.addEventListener("load",function(){for(var b=document.querySelectorAll("fieldset.collapse"),a=0;a