Re: [Tutor] sorting objects in lists by 2 attr

2007-07-24 Thread Kent Johnson
Philippe Niquille wrote: Tanks a mill! I don't know why I searched so far.. Anyway, I wrapped the django custom SQL call and built a nice dictionary out of the resulting rows (which is similar to querysets). See http://www.djangosnippets.org/snippets/207/

[Tutor] sorting objects in lists by 2 attr

2007-07-23 Thread Philippe Niquille
Hi I have a hard time sorting an object list. Perhaps this is kind of a noob question, but I would very much appreciate any help! Using django I get a QuerySet of Score objects which are sorted by the actual score, the actual score divided by the max. possible score (so sorting by two db

Re: [Tutor] sorting objects in lists by 2 attr

2007-07-23 Thread Eric Brunson
Philippe Niquille wrote: Hi I have a hard time sorting an object list. Perhaps this is kind of a noob question, but I would very much appreciate any help! Using django I get a QuerySet of Score objects which are sorted by the actual score, the actual score divided by the max. possible

Re: [Tutor] sorting objects in lists by 2 attr

2007-07-23 Thread Alan Gauld
Philippe Niquille [EMAIL PROTECTED] wrote The problem I now have, is that I lost the sorting order, as described above. How would I resort it with a python algortithm instead of SQL? Why not use SQL? Best to get the highest quality data into your program that you can, the earlier you

Re: [Tutor] sorting objects in lists by 2 attr

2007-07-23 Thread Eric Walstad
Philippe Niquille wrote: Using django I get a QuerySet of Score objects which are sorted by the actual score, the actual score divided by the max. possible score (so sorting by two db fields). I then need to loop through that queryset and sum up all the score objects which belong to the

Re: [Tutor] sorting objects in lists by 2 attr

2007-07-23 Thread Philippe Niquille
Tanks a mill! I don't know why I searched so far.. Anyway, I wrapped the django custom SQL call and built a nice dictionary out of the resulting rows (which is similar to querysets). See http://www.djangosnippets.org/snippets/207/ for details. Philippe Am 23.07.2007 um 19:28 schrieb Eric

Re: [Tutor] sorting objects in lists by 2 attr

2007-07-23 Thread Eric Brunson
SQL databases are cool. Make them do as much as they can for you. :-) Philippe Niquille wrote: Tanks a mill! I don't know why I searched so far.. Anyway, I wrapped the django custom SQL call and built a nice dictionary out of the resulting rows (which is similar to querysets). See