' % (link, new_parent)
)
self.assertNotEqual(table_output.find(row_html), -1, 'Failed to find expected row element: %s' % table_output)
diff --git a/tests/admin_utils/models.py b/tests/admin_utils/models.py
index dafb24e342..7b9c08a2f7 100644
--- a/tests/admin_utils/models.py
+++ b/tests/admin_utils/models.py
@@ -18,6 +18,9 @@ class Article(models.Model):
hist = models.CharField(max_length=100, verbose_name=_("History"))
created = models.DateTimeField(null=True)
+ def __str__(self):
+ return self.title
+
def test_from_model(self):
return "nothing"
diff --git a/tests/admin_utils/test_logentry.py b/tests/admin_utils/test_logentry.py
index ee56f6f1f5..09c09b0ea7 100644
--- a/tests/admin_utils/test_logentry.py
+++ b/tests/admin_utils/test_logentry.py
@@ -120,23 +120,23 @@ class LogEntryTests(TestCase):
json.loads(logentry.change_message),
[
{"changed": {"fields": ["domain"]}},
- {"added": {"object": "Article object", "name": "article"}},
- {"changed": {"fields": ["title"], "object": "Article object", "name": "article"}},
- {"deleted": {"object": "Article object", "name": "article"}},
+ {"added": {"object": "Added article", "name": "article"}},
+ {"changed": {"fields": ["title"], "object": "Changed Title", "name": "article"}},
+ {"deleted": {"object": "Title second article", "name": "article"}},
]
)
self.assertEqual(
logentry.get_change_message(),
- 'Changed domain. Added article "Article object". '
- 'Changed title for article "Article object". Deleted article "Article object".'
+ 'Changed domain. Added article "Added article". '
+ 'Changed title for article "Changed Title". Deleted article "Title second article".'
)
with translation.override('fr'):
self.assertEqual(
logentry.get_change_message(),
- "Modification de domain. Ajout de article « Article object ». "
- "Modification de title pour l'objet article « Article object ». "
- "Suppression de article « Article object »."
+ "Modification de domain. Ajout de article « Added article ». "
+ "Modification de title pour l'objet article « Changed Title ». "
+ "Suppression de article « Title second article »."
)
def test_logentry_get_edited_object(self):
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 2f52bd9925..16cc8d4b71 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -891,11 +891,11 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
ModelAdmin.changelist_view shouldn't result in a NoReverseMatch if url
for change_view is removed from get_urls (#20934).
"""
- UnchangeableObject.objects.create()
+ o = UnchangeableObject.objects.create()
response = self.client.get(reverse('admin:admin_views_unchangeableobject_changelist'))
self.assertEqual(response.status_code, 200)
# Check the format of the shown object -- shouldn't contain a change link
- self.assertContains(response, '
UnchangeableObject object
', html=True)
+ self.assertContains(response, '
%s
' % o, html=True)
def test_invalid_appindex_url(self):
"""
@@ -3306,7 +3306,7 @@ class AdminActionsTest(TestCase):
# No 500 caused by NoReverseMatch
self.assertEqual(response.status_code, 200)
# The page shouldn't display a link to the nonexistent change page
- self.assertContains(response, "
" % obj, 1, html=True)
def test_custom_function_mail_action(self):
"Tests a custom action defined in a function"
@@ -3692,12 +3692,12 @@ class AdminCustomQuerysetTest(TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(ShortMessage.objects.count(), 1)
# Message should contain non-ugly model verbose name
- pk = ShortMessage.objects.all()[0].pk
+ sm = ShortMessage.objects.all()[0]
self.assertContains(
response,
'