Skip to content

Commit

Permalink
Fixed #13521 -- Corrected javascript comparisons determining when to …
Browse files Browse the repository at this point in the history
…show and hide the 'add another' inline button. Thanks to darkrho for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13234 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed May 11, 2010
1 parent 6543539 commit 16c64bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions django/contrib/admin/media/js/inlines.js
Expand Up @@ -95,7 +95,7 @@
// Update number of total forms // Update number of total forms
$(totalForms).val(nextIndex + 1); $(totalForms).val(nextIndex + 1);
// Hide add button in case we've hit the max, except we want to add infinitely // Hide add button in case we've hit the max, except we want to add infinitely
if ((maxForms.val() != '') && (maxForms.val() <= totalForms.val())) { if ((maxForms.val() != '') && (maxForms.val()-totalForms.val()) <= 0) {
addButton.parent().hide(); addButton.parent().hide();
} }
// The delete button of each row triggers a bunch of other things // The delete button of each row triggers a bunch of other things
Expand All @@ -111,7 +111,7 @@
var forms = $("." + options.formCssClass); var forms = $("." + options.formCssClass);
$("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length); $("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
// Show add button again once we drop below max // Show add button again once we drop below max
if ((maxForms.val() == '') || (maxForms.val() >= forms.length)) { if ((maxForms.val() == '') || (maxForms.val()-forms.length) > 0) {
addButton.parent().show(); addButton.parent().show();
} }
// Also, update names and ids for all remaining form controls // Also, update names and ids for all remaining form controls
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/admin/media/js/inlines.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 16c64bc

Please sign in to comment.