Skip to content

Commit 0026791

Browse files
committed
feat(filters): Introduce DateInDateRange filter for Postgres
This commit introduces a new filter, `DateInDateRange`, specifically designed to work with PostgreSQL's DateRange fields. It allows filtering for records where a given date is contained within the date range field. Key changes: - Renamed `DateRangeDateFilter` to `DateInDateRange` for improved clarity and to better reflect its purpose. - Added documentation for the new filter in `docs/src/filters/date.md`. - Updated the main `README.md` to include the new filter. Additionally, the CI test matrix has been updated to streamline testing and drop support for older, unsupported versions: - Removed Python 3.9 and 3.10 from the test matrix. - Removed Django 3.2 from the test matrix.
1 parent f1dbab2 commit 0026791

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
strategy:
5858
max-parallel: 1
5959
matrix:
60-
python: [ "3.13", "3.10", "3.9" ]
61-
django: [ "52", "42", "32"]
60+
python: [ "3.13", "3.11"]
61+
django: [ "52", "42"]
6262
exclude:
6363
- django: 32
6464
python: 3.13

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Filters
2727
* ChoicesFieldComboFilter
2828
* Dates
2929
* DateRangeFilter
30+
* DateInDateRange
3031
* Radio
3132
* AllValuesRadioFilter
3233
* RelatedFieldRadioFilter

docs/src/filters/date.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ Filter dates. It allows complex filter like:
1717
| 2000-01-02..2000-12-02 | between 2000-01-02 and 2000-12-02 |
1818
| <> 2000-12-02 | not equal to 2000-01-02 |
1919
| 2000-01-01,2000-02-01,2000-03-01 | list of values |
20+
21+
22+
23+
## DateInDateRange
24+
25+
This filter is intended to be used spcifically for Postgres DateRange field and it
26+
inteded to return records where the provided value is inside the target field range.

src/adminfilters/dates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from .value import ValueFilter
1313

1414

15-
class DateRangeDateFilter(ValueFilter):
15+
class DateInDateRange(ValueFilter):
1616
lookup_name = "contains"
1717
input_type = "date"
1818

0 commit comments

Comments
 (0)