summaryrefslogtreecommitdiff
path: root/tests/admin_util
diff options
context:
space:
mode:
authorWiktor Kolodziej <wiktor@pykonik.org>2013-05-21 13:03:45 +0200
committerFlorian Apolloner <florian@apolloner.eu>2013-05-21 13:19:18 +0200
commitcec9558fba1bc6401ea2ec6d71b816b4dfd31b28 (patch)
tree25d82d122f1a3948085baf251f565ec54a029939 /tests/admin_util
parentb1ac241ddc8e496fae9bee5e88511d5698c18ca5 (diff)
Fixed #17308 -- Enabled the use of short_description on properties in the admin.
Diffstat (limited to 'tests/admin_util')
-rw-r--r--tests/admin_util/tests.py14
1 files changed, 14 insertions, 0 deletions
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