Re: Calculated value that depends in related models

2011-09-19 Thread graeme
On Sep 19, 9:51 pm, Andre Terra wrote: > Have you considered using a cache/store backend like redis[1] instead of > saving the result to the database? I did not think of it, but the problem is that I need to use the value in queries, filtering by several values of the model. How can I do that if

Re: Calculated value that depends in related models

2011-09-19 Thread Andre Terra
Have you considered using a cache/store backend like redis[1] instead of saving the result to the database? Using this approach, you can write a custom model method for returning the calculation, which can be called manually every time you need the result. The key difference being that this method

Calculated value that depends in related models

2011-09-19 Thread graeme
I want to save a calculated value to a model field. The calculation takes a few seconds and I need to query by it, so I think the denormalisation is justified. The problem is that the calculation requires data from two related models: one of which is the "through" model of a ManyToMany relationshi