Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #21299 - Changed filters from title to capfirst on admin inline…

… formsets.

Previously there was a mixture of the two which resulted in inconsistent
casing.
  • Loading branch information...
commit 43569647ab234cd1d2f4d41399b97b4b793d573a 1 parent 9bf5610
@renatooliveira renatooliveira authored timgraham committed
View
6 django/contrib/admin/templates/admin/edit_inline/stacked.html
@@ -1,11 +1,11 @@
{% load i18n admin_static %}
<div class="inline-group" id="{{ inline_admin_formset.formset.prefix }}-group">
- <h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}</h2>
+ <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</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.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>
+ <h3><b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</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="{% url 'admin:view_on_site' inline_admin_form.original_content_type_id inline_admin_form.original.pk %}">{% 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 %}
</h3>
@@ -24,7 +24,7 @@
prefix: '{{ inline_admin_formset.formset.prefix }}',
adminStaticPrefix: '{% static "admin/" %}',
deleteText: "{% trans "Remove" %}",
- addText: "{% blocktrans with verbose_name=inline_admin_formset.opts.verbose_name|title %}Add another {{ verbose_name }}{% endblocktrans %}"
+ addText: "{% blocktrans with verbose_name=inline_admin_formset.opts.verbose_name|capfirst %}Add another {{ verbose_name }}{% endblocktrans %}"
});
})(django.jQuery);
</script>
View
2  django/contrib/admin/templates/admin/edit_inline/tabular.html
@@ -74,7 +74,7 @@
$("#{{ inline_admin_formset.formset.prefix }}-group .tabular.inline-related tbody tr").tabularFormset({
prefix: "{{ inline_admin_formset.formset.prefix }}",
adminStaticPrefix: '{% static "admin/" %}',
- addText: "{% blocktrans with inline_admin_formset.opts.verbose_name|title as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}",
+ addText: "{% blocktrans with inline_admin_formset.opts.verbose_name|capfirst as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}",
deleteText: "{% trans 'Remove' %}"
});
})(django.jQuery);
View
8 tests/admin_inlines/tests.py
@@ -57,7 +57,7 @@ def test_many_to_many_inlines(self):
# The heading for the m2m inline block uses the right text
self.assertContains(response, '<h2>Author-book relationships</h2>')
# The "add another" label is correct
- self.assertContains(response, 'Add another Author-Book Relationship')
+ self.assertContains(response, 'Add another Author-book relationship')
# The '+' is dropped from the autogenerated form prefix (Author_books+)
self.assertContains(response, 'id="id_Author_books-TOTAL_FORMS"')
@@ -449,7 +449,7 @@ def test_inline_change_m2m_change_perm(self):
response = self.client.get(self.author_change_url)
# We have change perm on books, so we can add/change/delete inlines
self.assertContains(response, '<h2>Author-book relationships</h2>')
- self.assertContains(response, 'Add another Author-Book Relationship')
+ self.assertContains(response, 'Add another Author-book relationship')
self.assertContains(response, '<input type="hidden" id="id_Author_books-TOTAL_FORMS" '
'value="4" name="Author_books-TOTAL_FORMS" />', html=True)
self.assertContains(response, '<input type="hidden" id="id_Author_books-0-id" '
@@ -554,7 +554,7 @@ def test_add_stackeds(self):
self.assertEqual(rows_length(), 3)
add_button = self.selenium.find_element_by_link_text(
- 'Add another Inner4 Stacked')
+ 'Add another Inner4 stacked')
add_button.click()
self.assertEqual(rows_length(), 4)
@@ -570,7 +570,7 @@ def test_delete_stackeds(self):
self.assertEqual(rows_length(), 3)
add_button = self.selenium.find_element_by_link_text(
- 'Add another Inner4 Stacked')
+ 'Add another Inner4 stacked')
add_button.click()
add_button.click()
View
4 tests/admin_views/tests.py
@@ -3443,7 +3443,7 @@ def test_prepopulated_fields(self):
self.assertEqual(slug2, 'option-one-here-stacked-inline')
# Add an inline
- self.selenium.find_elements_by_link_text('Add another Related Prepopulated')[0].click()
+ self.selenium.find_elements_by_link_text('Add another Related prepopulated')[0].click()
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-1-pubdate').send_keys('1999-01-25')
self.get_select_option('#id_relatedprepopulated_set-1-status', 'option two').click()
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-1-name').send_keys(' now you haVe anöther sŤāÇkeð inline with a very ... loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog text... ')
@@ -3463,7 +3463,7 @@ def test_prepopulated_fields(self):
self.assertEqual(slug2, 'option-two-and-now-tabular-inline')
# Add an inline
- self.selenium.find_elements_by_link_text('Add another Related Prepopulated')[1].click()
+ self.selenium.find_elements_by_link_text('Add another Related prepopulated')[1].click()
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-2-1-pubdate').send_keys('1981-08-22')
self.get_select_option('#id_relatedprepopulated_set-2-1-status', 'option one').click()
self.selenium.find_element_by_css_selector('#id_relatedprepopulated_set-2-1-name').send_keys('a tÃbűlaŘ inline with ignored ;"&*^\%$#@-/`~ characters')
Please sign in to comment.
Something went wrong with that request. Please try again.