def get_values(self):
values = []
if self.model_field.choices:
values = [
SmartFilterValue(self.field_name, choice[1], choice[0], self.query_params) for choice in self.model_field.choices
]
elif type(self.model_field) == BooleanField:
values = [
SmartFilterValue(self.field_name, choice[1], choice[0], self.query_params) for choice in (
(1, _('Yes')),
(0, _('No'))
)
]
return [SmartFilterValue(self.field_name, _("All"), None, self.query_params)] + values
评论列表
文章目录