Fixed #17308 -- Enabled the use of short_description on properties in the admin.

This commit is contained in:
Wiktor Kolodziej 2013-05-21 13:03:45 +02:00 committed by Florian Apolloner
parent b1ac241ddc
commit cec9558fba
3 changed files with 44 additions and 3 deletions

View file

@ -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