1. 安装
pip install django-daterange-filter
2. 使用
from django.contrib import admin
form apps.test.models import Order
from daterange_filter.filter import DateRangeFilter
@admin.register(Order) class OrderAdmin(admin.ModelAdmin): list_display = ["id", "order_number", "create_time"] list_filter = [("create_time", DateRangeFilter)]
3. 实际效果