django-admin-rangefilter icon indicating copy to clipboard operation
django-admin-rangefilter copied to clipboard

Add TimeRangeFilter for filtering events by time

Open silentsokolov opened this issue 1 year ago • 0 comments

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 TimeRangeFilter class in rangefilter/filters.py, extending the BaseRangeFilter to support time range filtering.
  • Adds form fields for time input within the TimeRangeFilter, utilizing Django's AdminTimeWidget for user-friendly time selection.
  • Overrides the queryset method in TimeRangeFilter to filter records based on the specified time range, comparing only the time component of datetime fields.
  • Updates README.rst to include documentation and an example on how to use the new TimeRangeFilter in Django admin.
  • Introduces test cases in tests/tests.py to ensure the correct functionality of TimeRangeFilter, 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.

silentsokolov avatar May 02 '24 18:05 silentsokolov