On 6/6/07, Bryan Veloso <[EMAIL PROTECTED]> wrote:
>
> > This will grab _all_ score objects, and sort them by baseball score.
> > If there isn't a baseball score, then 'baseball' will have a value of
> > None, which is still a sortable value.
>
> Alright, so just to be safe, I really shouldn't be showing the values
> for all players, since that risks showing values for the other sports
> as well?

Based on what I know about your model (which isn't much), I'd say yes.

> Grabbing and sorting like this isn't an expensive task is it?

Depends what the alternative is. However, I would doubt that this
would be the bottleneck on your application.

> Would I use the same order_by functionality if I wanted to say...
> compare a person's score to the highest? Like a percentile thing?

That's a different question, and one to which Django doesn't have a
complete answer as yet. order_by is literally just a sorting
operation. It doesn't do comparisons. To do in-database comparisons,
you need to use aggregate clauses, which don't currently have a
representation in Django (this is one area I've been wanting to work
on for some time now).

There are other ways to do the comparsions (both in SQL and in your
view). Discovering those is left as an exercise to the reader :-)

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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