Django: list_filter using friendly name

In my admin.py, I filter by 'active' and 'country', this is done using the following line of code in my SomethingAdmin class ....

 list_filter = ['active', 'countryid']

As you can see, countryid is not very beautiful when displayed in my admin list view, how can I change this to a friendlier name, say, only "Country"?

Thank.

Update: Below seems to work:

incentiveid = models.ForeignKey(Incentive,verbose_name="Incentive", 
null=True, db_column='incentiveID', blank=True)
+5
source share
1 answer

As Aamir says, if you define labels in your fields in your model, you should see more attractive filter options:

class MyModel(models.Model):
    countryid = models.ForeignKey(Country, 
                                  verbose_name="Country", null=True, 
                                  db_column='countryID', blank=True)

, Country Model - Admin.

+4

All Articles