Django isnullfield admin filter Jan 25, 2018 Made for django 1.11, based on the BooleanFieldListFilter class IsNullFieldListFilter(FieldListFilter): def __init__(self, field, request, params, model, model_admin, field_path): self.lookup_kwarg = '%s__isnull' % field_path self.lookup_remove = '%s__exact' % field_path self.lookup_val = request.GET.get(self.lookup_kwarg) super().__init__(field, request, params, model, model_admin, field_path) if (self.used_parameters and self.lookup_kwarg in self.used_parameters and self.used_parameters[self.lookup_kwarg] in ('1', '0')): self.used_parameters[self.lookup_kwarg] = bool(int(self.used_parameters[self.lookup_kwarg])) def expected_parameters(self): return [self.lookup_kwarg] def choices(self, changelist): for lookup, title in ( (None, 'All'), ('1', 'No'), ('0', 'Yes')): yield { 'selected': self.lookup_val == lookup, 'query_string': changelist.get_query_string({self.lookup_kwarg: lookup,}, remove=[self.lookup_remove]), 'display': title, }