From 11208cedf8cd159b76cb65a99d3e7cce7ef6b947 Mon Sep 17 00:00:00 2001 From: Andrey Zelenchuk Date: Wed, 10 Jul 2019 17:30:43 +0700 Subject: [PATCH] Fix bug #392 "Inline model admin: wrong hiding of add button" --- polymorphic/static/polymorphic/js/polymorphic_inlines.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polymorphic/static/polymorphic/js/polymorphic_inlines.js b/polymorphic/static/polymorphic/js/polymorphic_inlines.js index 89225fc..a920e2b 100644 --- a/polymorphic/static/polymorphic/js/polymorphic_inlines.js +++ b/polymorphic/static/polymorphic/js/polymorphic_inlines.js @@ -128,7 +128,7 @@ nextIndex += 1; // Hide add button in case we've hit the max, except we want to add infinitely if ((maxForms.val() !== '') && (maxForms.val() - totalForms.val()) <= 0) { - addButtons.parent().hide(); + addContainer.hide(); } // The delete button of each row triggers a bunch of other things row.find("a." + options.deleteCssClass).click(function(e1) { @@ -146,7 +146,7 @@ $("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length); // Show add button again once we drop below max if ((maxForms.val() === '') || (maxForms.val() - forms.length) > 0) { - addButtons.parent().show(); + addContainer.show(); } // Also, update names and ids for all remaining form controls // so they remain in sequence: