How to change Django Admin Custom list field label

后端 未结 1 732
孤独总比滥情好
孤独总比滥情好 2021-02-11 14:56

How to change in_stock verbose_name ?

Models.py

class Book(models.Model):
 name = models.CharField(u\"Нэр\", max_length = 200)

 @property
 def in_stock(self):         


        
相关标签:
1条回答
  • 2021-02-11 15:37

    I guess you should use short_description attribute. Django-admin

    def in_stock(self):
      return self.stocks.count()
    in_stock.short_description = 'Your label here'
    
    0 讨论(0)
提交回复
热议问题