views:

15

answers:

1

Using google app engine and Django non-rel, I'm querying a list of movies and want to order them alphabetically.

movies = Movie.objects.all().order_by("title")

The problem is for any titles that do not start with an uppercase character is not following the same sort pattern.

So if queried these movies and returned them sorted then "iRobot" would not be between Batman and Zoolander:

  1. Armageddon
  2. Batman
  3. Zoolander
  4. iRobot

How do I get them to do a case-insensitive order_by?

Thanks

+1  A: 

You need to denormalize: store a separate property that contains a lower-case version of the title, and sort on that.

Nick Johnson
Denormalization is the answer to 80% of the "how do I do X on the GAE data store" questions.
Ranieri
Not the solution I was hoping for, but thank you for the answer
adam
Perhaps not, but it's the only indexable solution in _any_ DBMS. :)
Nick Johnson