0
나는 작은 프로젝트를 가지고 있으며 다음 문장을 얻지 못했습니다. 어떤 도움이라도 좋을 것입니다. 사용자 입력은 $ 값인 self.sale_head
일 수 있으며 $ 값이 추가되지 않는 경우 self.estimated_weight_hd
이 총 무게를 얻는 데 사용되는 경우 아래 코드는 총 판매 가격으로 사용할 수있는 estimated_weight_total
을 반환해야합니다. 모든 것은 내가 수동으로 estimated_weight_total
을 추가 할 때 작동합니다. 나는 왜 길을 잃었 느냐.Django의 문장이 제대로 작동하지 않는 경우
def calc_estimated_weight_total(self):
if self.sale_head <= 0:
amount = (self.number * self.estimated_weight_hd)
return amount
def save(self):
self.estimated_total_weight = self.calc_estimated_weight_total()
super(SaleNote, self).save()