I have a list of items and I define some way to rank them:

class Item:
    name = models.CharField()
    project = models.ManyToManyField(Project)

    def score(year):
        ... some intensive computation + queries ...
        return result

I'd like to display the items together with their score, and the mean
score and standard deviation:
    Items      | 2007        | 2006
    item1      |    2        |    2
    item2      | 1.33        | 3.92
    ...        |  ...        |  ...
    Mean (dev) | 1.68 (0.73) | 3.33 (1.54)

I use a tag to compute the score and std deviation for a given year,
but this involves
    {% get_score_stats item_list year as mean std_deviation %}

But this involves running the score query again for each item. Also, I
could want to compute other sorts of statistics and then quickly the
number of tags and queries grows up, which is bad.

What's the best way of doing this? Could I use Excel-like macros in
the template?

JJ.


--~--~---------~--~----~------------~-------~--~----~
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