Skip to main content

django-admin-daterange-listfilter

为Django模型列表页的时间过滤器增加日期范围选择功能。

使用方法

简化集成(django-app-requires)

本项目通过 app_requires 声明了依赖的 Django 应用,结合 django-app-requires 可自动补全 INSTALLED_APPS 中的依赖项,无需手动添加:

INSTALLED_APPS = [
    ...
    "django_admin_daterange_listfilter",
    ...
]

# 在 settings.py 末尾
from django_app_requires import patch_all as django_app_requires_patch_all
django_app_requires_patch_all()

patch_all() 会自动将 app_requires 中声明的依赖(如 django_static_jquery_ui 等)追加到 INSTALLED_APPS

传统手动配置

settings.py

INSTALLED_APPS = [
    ...
    "django_static_jquery_ui",
    "django_middleware_global_request",
    "django_listfilter_media_extension",
    "django_admin_daterange_listfilter",
    ...
]

MIDDLEWARE = [
    ...
    "django_middleware_global_request.middleware.GlobalRequestMiddleware",
    ...
]

admin.py

from django.contrib import admin
from django_admin_daterange_listfilter.filters import DateRangeFilter
from .models import Category


class CategoryAdmin(admin.ModelAdmin):
    list_display = [
        "title",
        "add_time",
        "mod_time",
    ]
    list_filter = [
        ("add_time", DateRangeFilter),
        ("mod_time", DateRangeFilter),
    ]


admin.site.register(Category, CategoryAdmin)

版本记录

v0.1.0

  • 版本首发。

v0.1.4

  • 添加中文i18n翻译。

v0.1.5

  • 添加default_app_config以增强兼容性。

v0.1.6

  • Doc update.

v0.1.7

  • 修复 QueryDict 参数值为 list 类型时触发 TypeError 的问题。
  • 修复无效日期输入导致 500 异常的问题。
  • 修复 params 就地修改产生副作用的问题。
  • 修复 JavaScript 使用非标准 window.location.query 的兼容性问题。
  • 新增单测覆盖正常/非法/空/列表参数/时区等场景。
  • 更新 .po 翻译文件头部信息。
  • 迁移打包配置至 pyproject.toml
  • 添加 build.sh 构建脚本。

v0.1.8

  • 添加项目仓库链接至 pyproject.toml
  • 更新文档说明。

v0.1.9

  • 修复 Django 5.2 中 'datetime.datetime' object is not iterable 错误。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_admin_daterange_listfilter-0.1.9.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file django_admin_daterange_listfilter-0.1.9.tar.gz.

File metadata

File hashes

Hashes for django_admin_daterange_listfilter-0.1.9.tar.gz
Algorithm Hash digest
SHA256 833d4b4b8dde652366e87c9b6ef18c6dd937775d8011e5e793e88061b5d1e410
MD5 556c64262930f4bbb6884121d373d0f2
BLAKE2b-256 edd3aecdd5e06aa6bd9fa0d31b004312100a839009f83b94a358c742d3104ff1

See more details on using hashes here.

File details

Details for the file django_admin_daterange_listfilter-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_daterange_listfilter-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 14fbaf8643444e378f18ac2019fdad1eb5c66560eb644a963c6289e4c976541b
MD5 eaadad7867450e7133c49f5930b275bf
BLAKE2b-256 0593f7dd40cb1f41079d3f8641477ba72bf4c96f114ead728b23bc3a7f8a441a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page