Skip to content

Add TimeRangeFilter for filtering events by time#117

Draft
silentsokolov wants to merge 1 commit into
masterfrom
add-time-filter
Draft

Add TimeRangeFilter for filtering events by time#117
silentsokolov wants to merge 1 commit into
masterfrom
add-time-filter

Conversation

@silentsokolov

@silentsokolov silentsokolov commented May 2, 2024

Copy link
Copy Markdown
Owner

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 silentsokolov marked this pull request as draft March 6, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant