Skip to content

Commit

Permalink
Merge pull request #6726 from kozlovsky/fix_6721_case_insensitive_sor…
Browse files Browse the repository at this point in the history
…t_by_name

Make sorting by name case insensitive
  • Loading branch information
kozlovsky authored Jan 16, 2022
2 parents f93d2b0 + 73b7821 commit f1de8bd
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,7 @@ def get_entries_query(
sort_expression = "desc(g.num_entries), desc(g.size)" if sort_desc else "g.num_entries, g.size"
pony_query = pony_query.sort_by(sort_expression)
elif sort_by:
sort_expression = "g." + sort_by
sort_expression = desc(sort_expression) if sort_desc else sort_expression
sort_expression = raw_sql(f"g.{sort_by} COLLATE NOCASE" + (" DESC" if sort_desc else ""))
pony_query = pony_query.sort_by(sort_expression)

if sort_by is None:
Expand Down

0 comments on commit f1de8bd

Please sign in to comment.