Learner looking for assistance
Anthony Smith
jackie.walkabout at gmail.com
Mon Apr 14 04:23:02 EDT 2014
On Monday, 14 April 2014 17:43:41 UTC+10, Anthony Smith wrote:
> Hi All
>
>
>
> I am probably doing something wrong but don't know what
>
> Any help would great
>
>
>
> Code below
>
>
>
> the calc_total does not return a estimated_total_weight
>
>
>
> if add the estimated_total_weight the rest of the code works
>
>
>
> I am at a lose as to why ?????
>
>
>
> def calc_total(self):
>
> amount = 0
>
> if self.estimated_weight_hd > 0:
>
> amount = self.number * self.estimated_weight_hd
>
> return amount
>
>
>
> def save(self):
>
> self.estimated_total_weight = self.calc_total()
>
> super(SaleNote, self).save()
>
>
>
> def calc_total_price(self):
>
> amount_price = 0
>
> if self.sale_head > 0:
>
> amount_price = self.number * self.sale_head
>
> return amount_price
>
> else:
>
> if self.estimated_total_weight > 0:
>
> amount_price = self.estimated_total_weight * self.sale_kg
>
> return amount_price
>
>
>
> def save(self):
>
> self.total_price = self.calc_total_price()
>
> super(SaleNote, self).save()
>
>
>
> thanks
>
>
>
> anthony
Thanks Ben this involves django as well forgot to mention in ear
lier post Maybe it a django issue rather code. Thats why I posted it here first.
thanks
cheers
More information about the Python-list
mailing list