From 5e2c95cd8c4e321441c307085083608ef3d576c8 Mon Sep 17 00:00:00 2001 From: Henning Bredel Date: Tue, 30 Apr 2024 11:22:03 +0200 Subject: [PATCH 1/2] Do not decrease TOTAL_FORMS counter --- src/jquery.formset.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/jquery.formset.js b/src/jquery.formset.js index 657766d..ce2c246 100644 --- a/src/jquery.formset.js +++ b/src/jquery.formset.js @@ -91,13 +91,8 @@ // and hide it, then let Django handle the deleting: del.val('on'); row.hide(); - forms = $('.' + options.formCssClass).not(':hidden'); - totalForms.val(forms.length); } else { row.remove(); - // Update the TOTAL_FORMS count: - forms = $('.' + options.formCssClass).not('.formset-custom-template'); - totalForms.val(forms.length); } for (var i=0, formCount=forms.length; i Date: Fri, 17 May 2024 08:02:56 +0200 Subject: [PATCH 2/2] Fix setting forms which are used later --- src/jquery.formset.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/jquery.formset.js b/src/jquery.formset.js index ce2c246..c7c0ef2 100644 --- a/src/jquery.formset.js +++ b/src/jquery.formset.js @@ -91,8 +91,10 @@ // and hide it, then let Django handle the deleting: del.val('on'); row.hide(); + forms = $('.' + options.formCssClass).not(':hidden'); } else { row.remove(); + forms = $('.' + options.formCssClass).not('.formset-custom-template'); } for (var i=0, formCount=forms.length; i