Django admin list_display short_description

brsbilgic picture brsbilgic · Jul 25, 2011 · Viewed 10.2k times · Source

In django admin, If we define an element for list_display we can assign short_description for that field as

class PersonAdmin(admin.ModelAdmin):
    list_display = ('upper_case_name','age')

    def upper_case_name(self, obj):
        return ("%s %s" % (obj.first_name, obj.last_name)).upper()
    upper_case_name.short_description = 'Name'

But what if I would like to change short description of age field ? I would like to show the header of Age field as Person's Age instead Age. Of course, I can write custom functions as upper_case_name for each field but it is a bad solution I think.

Could you suggest me any easy way to do this ? Thanks

Answer

shanyu picture shanyu · Jul 25, 2011

There are 2 model field options that provide descriptions to users: verbose_name and help_text. Using verbose names seems to be suitable in your case.