mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #17308 -- Enabled the use of short_description on properties in the admin.
This commit is contained in:
parent
b1ac241ddc
commit
cec9558fba
3 changed files with 44 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue