On Thu, Nov 5, 2009 at 4:10 PM, davisd <[email protected]> wrote:
>
> 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?
>
> Looks like:
http://code.djangoproject.com/ticket/11671
Karen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---