Пример #1
0
 def type(self):
     if self.amount.amount < 0:
         return DEBIT
     elif self.amount.amount > 0:
         return CREDIT
     else:
         # This should have been caught earlier by the database integrity check.
         # If you are seeing this then something is wrong with your DB checks.
         raise exceptions.ZeroAmountError()
Пример #2
0
 def save(self, *args, **kwargs):
     if self.amount.amount == 0:
         raise exceptions.ZeroAmountError()
     return super(Leg, self).save(*args, **kwargs)