Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework DateRangeFilter #852

Merged
merged 7 commits into from
Jul 13, 2018

Conversation

rpkilby
Copy link
Collaborator

@rpkilby rpkilby commented Jan 15, 2018

Minor update to DateRangeFilter.

Changes:

  • Replace the options data structure with standard form field choices and a filters dict, which contains the date filters separately. This is slightly easier to override.
  • Choices are now keyed by descriptive strings instead of by numbers.
  • Choices now maintain a consistent ordering (as opposed to unordered via dict)
  • Choices now leverage the empty_label option and corresponding setting, instead of ignoring it.
  • DateRangeFilter filtering tests now mock the now function, per the filters tests. This fixes Fix date range tests by asserting what isn't valid #400.
  • Fix DateRange filter: Yesterday option fails on January 1st #849.

@rpkilby rpkilby force-pushed the rework-daterangefilter branch from 7adda20 to 67e7bff Compare May 21, 2018 06:00
@codecov-io
Copy link

Codecov Report

Merging #852 into master will increase coverage by 0.09%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #852      +/-   ##
==========================================
+ Coverage   97.95%   98.04%   +0.09%     
==========================================
  Files          15       15              
  Lines        1122     1124       +2     
==========================================
+ Hits         1099     1102       +3     
+ Misses         23       22       -1
Impacted Files Coverage Δ
django_filters/filters.py 98.75% <100%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b554a5...21e0ca2. Read the comment docs.

Copy link
Owner

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. OK. 👍

@carltongibson carltongibson merged commit a0a74da into carltongibson:master Jul 13, 2018
@rpkilby rpkilby deleted the rework-daterangefilter branch July 13, 2018 13: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.

DateRange filter: Yesterday option fails on January 1st
3 participants