django-admin-rangefilter
django-admin-rangefilter copied to clipboard
Add TimeRangeFilter for filtering events by time
This pull request introduces a new TimeRangeFilter to the django-admin-rangefilter library, allowing users to filter records in the Django admin by time range, independent of the date. This feature addresses the need for filtering events or records that occur within a specific time frame across different days.
- Implements the
TimeRangeFilterclass inrangefilter/filters.py, extending theBaseRangeFilterto support time range filtering. - Adds form fields for time input within the
TimeRangeFilter, utilizing Django'sAdminTimeWidgetfor user-friendly time selection. - Overrides the
querysetmethod inTimeRangeFilterto filter records based on the specified time range, comparing only the time component of datetime fields. - Updates
README.rstto include documentation and an example on how to use the newTimeRangeFilterin Django admin. - Introduces test cases in
tests/tests.pyto ensure the correct functionality ofTimeRangeFilter, including its ability to filter across different days and time zones.
This enhancement broadens the library's utility by enabling more granular time-based filtering, catering to applications that manage time-sensitive data.
For more details, open the Copilot Workspace session.