In my admin.py I filter by 'active' and 'country' this is done using the following line of code within my SomethingAdmin class....
list_filter = ['active', 'countryid']
As you can see countryid is not pretty when displayed in my admin list view, how can I change this to a more friendly name, say just 'Country'?
Thanks.
Update: Below seems to work:
incentiveid = models.ForeignKey(Incentive,verbose_name="Incentive",
null=True, db_column='incentiveID', blank=True)
As Aamir says, if you define labels on your fields in your model, you should see the more attractive filter options:
class MyModel(models.Model):
countryid = models.ForeignKey(Country,
verbose_name="Country", null=True,
db_column='countryID', blank=True)
assuming that Country
is name of another Model
- this should show up in the Admin
filter view.
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