has anyone an idea how to add custom name to property in Django model? For example, if I got property:
@property def my_property(self): return u'Returns some calculations'
and I show it in admin as a column:
class MyAdmin(admin.ModelAdmin): list_display=['my_property',]
Then I see "My property" column and what I need is "Property X" column. I tried with my_property.short_description and my_property.verbose_name, none of this works.
The solution by Masatsugu Hosoi works fine, but you can also use the decorator and set short_description on the property getter (fget):
@property def my_property(self): return u'Returns some calculations' my_property.fget.short_description = u'Property X'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With