Permalink
Browse files

Fixed #13459 -- Corrected numbering of tr elements in the admin. Reve…

…rts the changes introduced in r13068. Thanks to 3point2 for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13083 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 4ca7c4e commit e99b283e77855d7b3a47803c663f6299bfaf79fa @freakboy3742 freakboy3742 committed May 4, 2010
@@ -53,12 +53,12 @@
}
addButton.click(function() {
var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS");
- var nextIndex = parseInt(totalForms.val()) + 1;
+ var nextIndex = parseInt(totalForms.val());
var template = $("#" + options.prefix + "-empty");
var row = template.clone(true);
row.removeClass(options.emptyCssClass)
.addClass(options.formCssClass)
- .attr("id", options.prefix + nextIndex)
+ .attr("id", options.prefix + "-" + nextIndex)
.insertBefore($(template));
row.find("*")
.filter(function() {
@@ -93,7 +93,7 @@
updateElementIndex(this, options.prefix, totalForms.val());
});
// Update number of total forms
- $(totalForms).val(nextIndex);
+ $(totalForms).val(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())) {
addButton.parent().hide();

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -4,7 +4,7 @@ <h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}</h2>
{{ inline_admin_formset.formset.management_form }}
{{ inline_admin_formset.formset.non_form_errors }}
-{% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if forloop.last %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}{% if not forloop.last %}{{ forloop.counter }}{% else %}-empty{% endif %}">
+{% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if forloop.last %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
<h3><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b>&nbsp;<span class="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %}#{{ forloop.counter }}{% endif %}</span>
{% if inline_admin_form.show_url %}<a href="../../../r/{{ inline_admin_form.original_content_type_id }}/{{ inline_admin_form.original.id }}/">{% trans "View on site" %}</a>{% endif %}
{% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
@@ -21,7 +21,7 @@ <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
<tr><td colspan="{{ inline_admin_form.field_count }}">{{ inline_admin_form.form.non_field_errors }}</td></tr>
{% endif %}
<tr class="{% cycle "row1" "row2" %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}{% if forloop.last %} empty-form{% endif %}"
- id="{{ inline_admin_formset.formset.prefix }}{% if not forloop.last %}{{ forloop.counter }}{% else %}-empty{% endif %}">
+ id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
<td class="original">
{% if inline_admin_form.original or inline_admin_form.show_url %}<p>
{% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}

0 comments on commit e99b283

Please sign in to comment.