groupby() filter performs auto sorting under the hood, and it should support specifying case sensitivity for the sort order, the same way sort() filter does.
Current groupby() implementation always performs case-sensitive sorting under the hood, which makes it inflexible, and behave inconsistently with how the sort() filter works (case-insensitive by default). When used in the same template for the same dataset, groupby() and sort() filters produce different sort order on the same fields.
I think, I would personally prefer to not have any implicit sorting in groupby(), and chain it with sort() explicitly, but I do understand that auto sorting was, probably, added to groupby() for convenience.
Implementing an option to control case sensitivity seems to be pretty straightforward:
- A
case_sensitive parameter can be added to do_groupby() function, similar to do_sort().
make_attrgetter() inside do_groupby() should be called with postprocess=ignore_case if case_sensitive==False.
If this feature request looks reasonable, I should be able to submit a pull request.
groupby()filter performs auto sorting under the hood, and it should support specifying case sensitivity for the sort order, the same waysort()filter does.Current
groupby()implementation always performs case-sensitive sorting under the hood, which makes it inflexible, and behave inconsistently with how thesort()filter works (case-insensitive by default). When used in the same template for the same dataset,groupby()andsort()filters produce different sort order on the same fields.I think, I would personally prefer to not have any implicit sorting in
groupby(), and chain it withsort()explicitly, but I do understand that auto sorting was, probably, added togroupby()for convenience.Implementing an option to control case sensitivity seems to be pretty straightforward:
case_sensitiveparameter can be added todo_groupby()function, similar todo_sort().make_attrgetter()insidedo_groupby()should be called withpostprocess=ignore_caseifcase_sensitive==False.If this feature request looks reasonable, I should be able to submit a pull request.