Browse files

Sorting & Filtering fix

* 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...
1 parent 9157936 commit f07678e32cee14274f54ab0881a789b4b1b4cc92 @acdha acdha committed Mar 3, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 glossary/views.py
View
4 glossary/views.py
@@ -27,6 +27,8 @@ def term_list(request, **kwargs):
else:
initial = request.GET.get("l", "a").lower()
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)

0 comments on commit f07678e

Please sign in to comment.