我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django_filters.NumberFilter()。
def test_filterset_descriptions(): class ArticleIdFilter(django_filters.FilterSet): class Meta: model = Article fields = ['id'] max_time = django_filters.NumberFilter(method='filter_max_time', label="The maximum time") field = DjangoFilterConnectionField(ArticleNode, filterset_class=ArticleIdFilter) max_time = field.args['max_time'] assert isinstance(max_time, Argument) assert max_time.type == Float assert max_time.description == 'The maximum time'