You have to convert s.price.name to float (or .9 to a DecimalObject if
the float-precision should be a problem).
This should work:
for s in s2:
s.price.name = float(s.price.name) * .9
s.price.save()
On Dec 16, 8:43 pm, Greg <[EMAIL PROTECTED]> wrote:
> Shabda,
> I added the
Shabda,
I added the following code to my view:
for s in s2:
s.price.name *= s.price.name * .9
s.price.save()
However, I now get the error:
TypeError at /plush/chandra/antara/108/multi/
unsupported operand type(s) for *: 'Decimal' and 'float'
On Dec 16,
How about
for s in s2:
s.price.name *= s.price.name * .9
s.price.save()
You are getting a type error coz you can not mutlipy a Model object by
float, and that is what s.price is. BTW s2[0].price * .9 would not
have worked as well, because of the same reasons!
On Dec 16, 11:08
Hi,
On Sun, Dec 16, 2007 at 10:08:14AM -0800, Greg wrote:
>
> Forest,
> Here are my models
>
> class Style(models.Model):
> name = models.CharField(maxlength=200, core=True)
> image = models.ForeignKey(Photo)
> collection = models.ForeignKey(Collection,
> edit_inline=models.TABULAR,
Forest,
Here are my models
class Style(models.Model):
name = models.CharField(maxlength=200, core=True)
image = models.ForeignKey(Photo)
collection = models.ForeignKey(Collection,
edit_inline=models.TABULAR, num_in_admin=1, num_extra_on_change=3)
sandp =
Hi,
On Sun, Dec 16, 2007 at 08:37:08AM -0800, Greg wrote:
> I've tried the following:
>
> for s in s2:
> s.price *= s.price * .9
>
> However, I still get the following error:
>
> TypeError at /plush/chandra/antara/108/multi/
> unsupported operand type(s) for *: 'Price' and 'float'
Can
Hi,
On Sun, Dec 16, 2007 at 07:59:52AM -0800, Greg wrote:
> 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),
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,
for s in s2:
s.price *= .9
--Ned.
Greg wrote:
> Hello,
> I have the following list:
>
> [, )>, Small'>, )>, , )>,
> , )>, ,
> )>]
>
> 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
Hello,
I have the following list:
[, )>, , )>, , )>,
, )>, ,
)>]
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
10 matches
Mail list logo