Hi,
I want to get total price (quantity*price) in this example for objest
list (not one) of A class
class A(models.Model)
name = models.CharField(max_length=255)
class B(models.Model)
quantity = models.PositiveIntegerField()
price = models.DecimalField(max_digits=10, decimal_places=2)
a = models.ForeignKey(A)
I try:
A.objects.all().select_related().annotate(my_sum=Sum
('b__price*b__quantity'))
but it doesn't work...
Please help.
Thank You,
regards.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---