Thanks for answering Ken!
I tend to think that what I’m trying to do it’s already done by someone so, surely there’s a better way to do it than mine.
Here is the code from the models.
This is what I wanted to do from the beginning but I did it wrong and you corrected me.
Possible solutions:
-
I never implemented caching because this is a school project but I’d like to implement it if there’s the need.
-
Another solution would be to refactor the functions to use
Variable.objects...
only one time. (What you’ve said above) -
Last but not least, I can exclude this fields from the table, avoiding the calculations in batch.