开发者

Is there a "short_description" method for variables in Django?

开发者 https://www.devze.com 2023-02-20 08:38 出处:网络
I have a long variable name in one of my models \"xxxx_xxxx_xx_xxxxxxxx\" is there an equivilent of: xxxx_xxxx_xx_xxxxxxxx.short_description = \'xxxx\'

I have a long variable name in one of my models "xxxx_xxxx_xx_xxxxxxxx" is there an equivilent of:

xxxx_xxxx_xx_xxxxxxxx.short_description = 'xxxx'

for variables or do I have to make a method to display that? I would like to not have to use a 开发者_JS百科method because I want to be able to sort by this variable in the Django admin. Thanks.


Look at the verbose field name option. It allows you use whatever name you like in the admin. There is also the verbose_name_plural for model names that have unusual plural construxions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号