跳转到主要内容

提供基于__isnull过滤的简单list_filter。

项目描述

https://badge.fury.io/py/django-isnull-list-filter.svg https://travis-ci.org/petrdlouhy/django-isnull-list-filter.svg?branch=master https://codecov.io/gh/petrdlouhy/django-isnull-list-filter/branch/master/graph/badge.svg

提供基于__isnull或空白字符字段的过滤的简单list_filter。

文档

完整文档在 https://django-isnull-list-filter.readthedocs.io

快速入门

安装django-isnull-list-filter

pip install django-isnull-list-filter

或使用开发版本

pip install -e git+https://github.com/PetrDlouhy/django-isnull-list-filter#egg=django-isnull-list-filter

直接在您的管理界面中使用

from isnull_filter import isnull_filter
  class MyAdmin(admin.ModelAdmin):
     list_filter = (
         isnull_filter('author'),  # Just set the field
         isnull_filter('author', _("Hasn't got author")),  # Or you can override the default filter title
         isnull_filter('author', _("Has got author"), negate=True),  # And you can negate the condition
     )

from isnull_filter import isblank_filter
  class MyAdmin(admin.ModelAdmin):
     list_filter = (
         isblank_filter('author'),  # Just set the field
         isblank_filter('author', _("Hasn't got author")),  # Or you can override the default filter title
         isblank_filter('author', _("Has got author"), negate=True),  # And you can negate the condition
     )

功能

  • 可用于
    • 简单字段

    • ForeignKeyField

    • 相关 ForeignKeyField

    • ManyToManyField

    • OneToOneField

  • 默认标题可以被覆盖

运行测试

代码真的工作吗?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

致谢

作者

  • Petr Dlouhý

在渲染此包中使用的工具

历史

0.3.2 (2021-12-16)

  • Django 4.0的修复

0.3.1 (2021-11-18)

  • 修复isblank_filter

0.3.0 (2021-11-17)

  • 添加isblan_filter

0.1.0 (2017-04-26)

  • 首次发布于PyPI。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

django-isnull-list-filter-0.3.2.tar.gz (18.3 kB 查看哈希值)

上传时间 源码

由以下支持