Python django_filters 模块,NumberFilter() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django_filters.NumberFilter()

项目:graphene-django    作者:graphql-python    | 项目源码 | 文件源码
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'