Пример #1
0
 def save(self):
     new_item = Item(category=self.cleaned_data['category'],
         price=self.cleaned_data['price'],
         pub_date=self.cleaned_data['pub_date'],
         comment=self.cleaned_data['comment'])
     if not new_item.category.isIncome:
         if new_item.price>0:
             new_item.price = new_item.price*-1
     else:
         if new_item.price<0:
             new_item.price = new_item.price*-1
             
     return new_item