From cec9558fba1bc6401ea2ec6d71b816b4dfd31b28 Mon Sep 17 00:00:00 2001 From: Wiktor Kolodziej Date: Tue, 21 May 2013 13:03:45 +0200 Subject: Fixed #17308 -- Enabled the use of short_description on properties in the admin. --- tests/admin_util/tests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/admin_util/tests.py b/tests/admin_util/tests.py index 7898f200b5..35b7681cbb 100644 --- a/tests/admin_util/tests.py +++ b/tests/admin_util/tests.py @@ -236,6 +236,20 @@ class UtilTests(unittest.TestCase): ("not Really the Model", MockModelAdmin.test_from_model) ) + def test_label_for_property(self): + # NOTE: cannot use @property decorator, because of + # AttributeError: 'property' object has no attribute 'short_description' + class MockModelAdmin(object): + def my_property(self): + return "this if from property" + my_property.short_description = 'property short description' + test_from_property = property(my_property) + + self.assertEqual( + label_for_field("test_from_property", Article, model_admin=MockModelAdmin), + 'property short description' + ) + def test_related_name(self): """ Regression test for #13963 -- cgit v1.3