Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion django/contrib/admin/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def inline_formset_data(self):
"name": "#%s" % self.formset.prefix,
"options": {
"prefix": self.formset.prefix,
"addText": gettext("Add another %(verbose_name)s")
"addText": gettext("Add %(verbose_name)s")
% {
"verbose_name": capfirst(verbose_name),
},
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/admin/static/admin/js/inlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
/* Setup plugin defaults */
$.fn.formset.defaults = {
prefix: "form", // The form prefix for your django formset
addText: "add another", // Text for the add link
addText: "add", // Text for the add link
deleteText: "remove", // Text for the delete link
addCssClass: "add-row", // CSS class applied to the add link
deleteCssClass: "delete-row", // CSS class applied to the delete link
Expand Down
Binary file modified docs/intro/_images/admin10t.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/intro/_images/admin11t.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/intro/_images/admin14t.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 47 additions & 53 deletions tests/admin_inlines/tests.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/admin_views/test_autocomplete_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ def assertNoResults(row):
rows = self.selenium.find_elements(By.CSS_SELECTOR, ".dynamic-authorship_set")
self.assertEqual(len(rows), 3)
assertNoResults(rows[0])
# Autocomplete works in rows added using the "Add another" button.
self.selenium.find_element(By.LINK_TEXT, "Add another Authorship").click()
# Autocomplete works in rows added using the "Add" button.
self.selenium.find_element(By.LINK_TEXT, "Add Authorship").click()
rows = self.selenium.find_elements(By.CSS_SELECTOR, ".dynamic-authorship_set")
self.assertEqual(len(rows), 4)
assertNoResults(rows[-1])
16 changes: 6 additions & 10 deletions tests/admin_views/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5915,9 +5915,7 @@ def test_prepopulated_fields(self):
self.assertEqual(num_initial_select2_inputs, 4)

# Add an inline
self.selenium.find_elements(By.LINK_TEXT, "Add another Related prepopulated")[
0
].click()
self.selenium.find_elements(By.LINK_TEXT, "Add Related prepopulated")[0].click()
self.assertEqual(
len(self.selenium.find_elements(By.CLASS_NAME, "select2-selection")),
num_initial_select2_inputs + 2,
Expand Down Expand Up @@ -5974,9 +5972,9 @@ def test_prepopulated_fields(self):

# Add an inline
# Button may be outside the browser frame.
element = self.selenium.find_elements(
By.LINK_TEXT, "Add another Related prepopulated"
)[1]
element = self.selenium.find_elements(By.LINK_TEXT, "Add Related prepopulated")[
1
]
self.selenium.execute_script("window.scrollTo(0, %s);" % element.location["y"])
element.click()
self.assertEqual(
Expand Down Expand Up @@ -6005,9 +6003,7 @@ def test_prepopulated_fields(self):
# Add an inline without an initial inline.
# The button is outside of the browser frame.
self.selenium.execute_script("window.scrollTo(0, document.body.scrollHeight);")
self.selenium.find_elements(By.LINK_TEXT, "Add another Related prepopulated")[
2
].click()
self.selenium.find_elements(By.LINK_TEXT, "Add Related prepopulated")[2].click()
self.assertEqual(
len(self.selenium.find_elements(By.CLASS_NAME, "select2-selection")),
num_initial_select2_inputs + 6,
Expand All @@ -6033,7 +6029,7 @@ def test_prepopulated_fields(self):
# Add inline.
self.selenium.find_elements(
By.LINK_TEXT,
"Add another Related prepopulated",
"Add Related prepopulated",
)[3].click()
row_id = "id_relatedprepopulated_set-4-1-"
self.selenium.find_element(By.ID, f"{row_id}pubdate").send_keys("1999-01-20")
Expand Down