Skip to content

Commit

Permalink
Sorting & Filtering fix
Browse files Browse the repository at this point in the history
* Sorting was previously case-sensitive
* Selecting a first letter used to be case-sensitive (i.e. "a" would
  match "aubergine" but not "America")
  • Loading branch information
acdha committed Mar 3, 2010
1 parent 9157936 commit f07678e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion glossary/views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def term_list(request, **kwargs):
else: else:
initial = request.GET.get("l", "a").lower() initial = request.GET.get("l", "a").lower()
ec['starts_with'] = initial ec['starts_with'] = initial
terms = terms.filter(title__startswith=ec['starts_with']) terms = terms.filter(title__istartswith=ec['starts_with'])

terms = terms.extra(select={"lower_title": "LOWER(title)"}).order_by("lower_title")


return object_list(request, queryset=terms, extra_context=ec, **kwargs) return object_list(request, queryset=terms, extra_context=ec, **kwargs)

0 comments on commit f07678e

Please sign in to comment.