ChrisC
ChrisC

Reputation: 916

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

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 method because I want to be able to sort by this variable in the Django admin. Thanks.

Upvotes: 0

Views: 966

Answers (1)

Peter Rowell
Peter Rowell

Reputation: 17713

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.

Upvotes: 2

Related Questions