Closed W0rtX closed 2 years ago
Show your ModelAdmin
from rangefilter.filter import AdminSplitDateTime, DateTimeRangeFilter as OriginalDateTimeRangeFilter class TaskAdmin(admin.ModelAdmin): list_display = ( 'created_at', 'finished_at', ) list_filter = ( ('created_at', OriginalDateTimeRangeFilter), )
list_filter = (
('created_at', OriginalDateTimeRangeFilter),
('finished_at', OriginalDateTimeRangeFilter),
)
Does it not work?
This works, but two filters are created: by creation date and by finished date, and I need to make sure that these two fields are combined in one filter: DateFrom is compared with the creation date, and DateTo with the finished date
Please check version from the master branch
Hello, thank you for your code!
Could you tell, how i can range filter by two fields?
My model have fields: created and finished. If i add filter into list filter in django-admin, i receive next url: ?q=&created_atrangegte_0=2021-10-01&created_atrangegte_1=22%3A00&created_atrangelte_0=2021-10-03&created_atrangelte_1=8%3A00
But i need next url: ?q=&created_atrangegte_0=2021-10-01&created_atrangegte_1=22%3A00&finished_atrangelte_0=2021-10-03&finished_atrangelte_1=8%3A00
Is there a simple way to do this? Thanks