related: https://groups.google.com/forum/#!topic/django-users/s9qgXC4TNrA
On Sunday, November 23, 2014 4:42:48 PM UTC-6, Jorge Andrés Vergara Ebratt wrote:
-- Short answer: you can't. A raw query would be your best bet(i.e. "SELECT SUM(a + b) AS sum FROM app_X")
Thanks in advance for the helpSo, when I'm inside a template I can call {{x.getC}} and it gets the method for the current instance it's in, but how can I get the Sum, or Avg of that method? I tried doing Sum('getC') but I get the error because getC isn't callable in the query...return a + bdef getC(self):b = models.IntegerField()a = models.IntegerField()class X(models.Model)I have a model XHello everyone,Well, the tittle says it all:
--Jorge Andres Vergara Ebratt#SoftwareDeveloper (Or at least trying to be)@javebratt
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5350447-264f-4145-be9d-8ea709673918%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment