carltongibson / django-filter

A generic system for filtering Django QuerySets based on user selections
https://django-filter.readthedocs.io/en/main/
Other
4.39k stars 760 forks source link

Fix grouped choices as dict #1668

Open saevarom opened 1 month ago

saevarom commented 1 month ago

Here is an attempt to fix #1667

I decided to go for a simple approach in normalizing the choices, and used a utility function from django 5.0. I think that's OK since this method of defining choices was first introduced in django 5.0.

carltongibson commented 1 week ago

Oh, except the tests didn't like it...

carltongibson commented 1 day ago

@saevarom I'm looking towards a release. Do you have time to address the failing test on Django 4.2?

saevarom commented 1 day ago

I'll take a look now

saevarom commented 1 day ago

@carltongibson I've pushed a fix, could you approve the test run?

carltongibson commented 1 day ago

@saevarom great thanks. The isort run is playing up. I can look at that later on. Other than that :+1:

carltongibson commented 1 day ago

django_filters/filters.py:34:5: F401 'django.utils.choices.BaseChoiceIterator' imported but unused

carltongibson commented 1 day ago

Great. Thanks 🎁

github-actions[bot] commented 1 day ago

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  django_filters
  filters.py 494
Project Total  

This report was generated by python-coverage-comment-action

carltongibson commented 1 day ago

@saevarom If we want perfect coverage here we'd also need to check the assert is raised for Django 4.2...

https://github.com/carltongibson/django-filter/pull/1668#issuecomment-2239311195