On Wed, 2008-07-09 at 06:25 -0700, [EMAIL PROTECTED] wrote:
> Thanks Malcolm for a speedy response!
> 
> I guess my best bit is to somehow output the QuerySet into a list
> which I can then order myself (although this seems a bit ugly!), or
> have a rethink about the design of the two models.

If you only have a few hundred (or even more) records, doing the sort in
Python is a very valid option. Python is blindingly fast at sorting
things. In fact, one way to make algorithms fast in Python is to work
out how to convert them into a sorting operation.

So don't feel bad about doing that last step in Python. The only time it
won't be a good idea is if you have more records than will comfortably
fit into memory so you are sorting and then limiting on the database
side (to avoid pulling back more than you can use). In that case, you
need to sort before the limit and you're back to the original problem.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to