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')
Now is there any way so that i can set decommissioned filter to 'N'
by default instead of 'All'
?