DECOM_CHOICES = (
('N', 'No'),
('Y', 'Yes'),
)
class Host(models.Model):
hostname = models.CharField(max_length=36, unique=True)
decommissioned = models.CharField(max_length=1, choices=DECOM_CHOICES, default='N')
ip_address = models.IPAddressField()
def __unicode__(self):
return self.hostname
class HostAdmin(admin.ModelAdmin):
fieldsets = [
('Host Info', {'fields': ['hostname','decommissioned','ip_address']}),
list_display = ('hostname', 'ip_address', 'decommissioned')
list_filter = ('decommissioned')
现在有什么办法可以让我将退役过滤器'N'
默认设置为而不是'All'
?