def get_filters(self, request): filter_specs = [] if self.list_filter: for filter_name in self.list_filter: field = self.model.fields().get(filter_name) spec = FilterSpec.create(field, request, self.params, self.model, self.model_admin, field_path=filter_name) if spec and spec.has_output(): filter_specs.append(spec) return filter_specs, bool(filter_specs)
def get_filters(opts, request, params, dataModel): filter_specs = [] try: if dataModel.Admin.list_filter: filter_fields = [opts.get_field(field_name) \ for field_name in dataModel.Admin.list_filter] for f in filter_fields: spec = FilterSpec.create(f, request, params, dataModel) if spec and spec.has_output(): filter_specs.append(spec) except Exception, e: #print "get_filters", e.message pass