transactions: add filter against 0.00 transactions
This commit is contained in:
parent
939159a1c9
commit
447224b0fe
|
@ -1,6 +1,10 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.core.validators import *
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
class TransactionType(models.Model):
|
class TransactionType(models.Model):
|
||||||
""" Type for a :class:`Transaction`. States how the money has
|
""" Type for a :class:`Transaction`. States how the money has
|
||||||
been added to the account and if somebody needs to check
|
been added to the account and if somebody needs to check
|
||||||
|
@ -16,9 +20,10 @@ class Transaction(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
transactionType = models.ForeignKey(TransactionType, verbose_name='Typ')
|
transactionType = models.ForeignKey(TransactionType, verbose_name='Typ')
|
||||||
dateTime = models.DateTimeField()
|
dateTime = models.DateTimeField()
|
||||||
amount = models.DecimalField(max_digits=8, decimal_places=2)
|
amount = models.DecimalField(max_digits=8, decimal_places=2, validators=[MinValueValidator(Decimal("0.01"))])
|
||||||
checked = models.BooleanField(default=False)
|
checked = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u"%s for user %s (%s),%schecked" % (self.amount, self.user, self.transactionType, (self.checked and " " or " not "))
|
return u"%s for user %s (%s),%schecked" % (self.amount, self.user, self.transactionType, (self.checked and " " or " not "))
|
||||||
# TODO: Find out what would happen if parent save/delete does not like us
|
# TODO: Find out what would happen if parent save/delete does not like us
|
||||||
|
|
Loading…
Reference in New Issue