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

WIP filters: when invalid filter value, use default value if there is one #1308

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Rineee
Copy link
Contributor

@Rineee Rineee commented Dec 30, 2022

When the filter argument is invalid, django adds and shows the label 'All', also in the case that this isnt a 'real' choice.
With this, it would now use the default value of the filter if there is one.

@github-actions
Copy link

Coverage report

Total coverage

Status Category Percentage Covered / Total
🔴 Statements 9.22% 105/1139
🔴 Branches 10.97% 77/702
🔴 Functions 9.54% 35/367
🔴 Lines 15.66% 548/3500

Status of coverage: 🟢 - ok, 🟡 - slightly more than threshold, 🔴 - under the threshold

Report generated by 🧪jest coverage report action from ff64537

Copy link
Contributor

@fuzzylogic2000 fuzzylogic2000 left a comment

Choose a reason for hiding this comment

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

Very nice!
Do you want to add the tests here or later? 🙃

@Rineee Rineee changed the title filters: when invalid filter value, use default value if there is one WIP filters: when invalid filter value, use default value if there is one Jan 3, 2023
@Rineee
Copy link
Contributor Author

Rineee commented Jan 17, 2023

So this is not working, the tests are failing as it still takes the ordering by pks.. maybe this could help? https://django-filter.readthedocs.io/en/stable/ref/filterset.html#custom-forms-using-form

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.

2 participants