0
如何在Django Admin中添加一个过滤器,该过滤器应该在模型仪表板右侧显示的过滤器中给出过滤结果。Django中的自定义过滤器(1.3)Admin
更清楚:
class County (models.Model):
status = models.CharField(max_length = 255, blank = True)
name = models.CharField(max_length = 255, blank = True)
class County_info (models.Model):
county = models.ForeignKey(County)
city = models.CharField(max_length = 255, blank = True)
state = models.CharField(max_length = 255, blank = True)
......
......
在我adim.py我必须表明该模型“County_info”的具有状态“生产”领域“县”的过滤器。
list_filter = ['county__name', ] # will Show all data in that table. I need onlt the data which has status= 'production'
我该怎么做?