Ned,
I've added that code into my view. However, now I'm getting
the
following error:
TypeError at /manu/coll/style/
unsupported operand type(s) for *=: 'Price' and 'float'
////////////////
I can't do a int(s.price), because then I get a 'Can't
assign to
function call' error.
On Dec 15, 9:12 pm, Ned Batchelder <n... nedbatchelder.com> wrote:
> for s in s2:
> s.price *= .9
>
> --Ned.
>
>
>
> Greg wrote:
> > Hello,
> > I have the following list:
>
> > [<Choice: (<Size: Extra Small>,
<Price: 142>)>, <Choice: (<Size:
> > Small'>, <Price: 345>)>, <Choice:
(<Size: Medium'>, <Price: 913>)>,
> > <Choice: (<Size: Large>, <Price:
1214>)>, <Choice: (<Size: Largest'>,
> > <Price: 1447>)>]
>
> > In my view I want to be able to modify the Price
of each element. I
> > want to times the price of each element by .9.
Here is my code that
> > creates the above list:
>
> > s2 = b.sandp.order_by('orderdisplay')
>
> > I know that I can do 's2[0].price * .9'. However,
that just modifies
> > the first element. Is there anyway that I can do
this for every
> > element all at once?
>
> > Thanks
>
> --
> Ned Batchelder,http://nedbatchelder.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|