Adding an extra field (calculated_price):
calculated_items = Item.objects.filter(cart=self).extra(select=
{'calculated_price': 'unit_price * quantity'})
works great and the queryset items have the new calculated_price
field.
calculated_items.aggregate(Sum('calculated_price'))
raises an Exception, telling me:
Cannot resolve keyword 'calculated_price' into field. Choices are: ...
(list of fields on the model)
It seems to me aggregate should look for available fields in the
queryset as opposed to looking on the model.
Is this a django bug or am I doing something wrong?
Thanks for any help!
-David
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---