summaryrefslogtreecommitdiff
path: root/tests/admin_views/tests.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-08-24 11:52:58 -0400
committerTim Graham <timograham@gmail.com>2015-08-28 09:03:34 -0400
commit3cc67a637a3cd1426d2ac87d7418600fa247ebb2 (patch)
treef28b96aee6830482ee067f58f85b8212577a69b9 /tests/admin_views/tests.py
parent4f83bfa9e5ef10c6c9711ad529630d09a06ef413 (diff)
[1.8.x] Fixed #25299 -- Fixed crash with ModelAdmin.list_display value that clashes with a model reverse accessor.
Backport of 9607a0404188bbe612f05216f5a82df26f4b4e80 from master
Diffstat (limited to 'tests/admin_views/tests.py')
-rw-r--r--tests/admin_views/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index b5dff27e6b..dd96715605 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -4230,6 +4230,16 @@ class RawIdFieldsTest(TestCase):
self.assertNotContains(response2, "Kilbraken")
self.assertContains(response2, "Palin")
+ def test_list_display_method_same_name_as_reverse_accessor(self):
+ """
+ Should be able to use a ModelAdmin method in list_display that has the
+ same name as a reverse model field ("sketch" in this case).
+ """
+ actor = Actor.objects.create(name="Palin", age=27)
+ Inquisition.objects.create(expected=True, leader=actor, country="England")
+ response = self.client.get(reverse('admin:admin_views_inquisition_changelist'))
+ self.assertContains(response, 'list-display-sketch')
+
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF="admin_views.urls")