k4ever/k4ever/transaction/models.py

24 lines
691 B
Python
Raw Normal View History

2010-10-13 02:57:59 +02:00
from django.db import models
from django.contrib.auth.models import User
class TransactionType(models.Model):
name = models.CharField(max_length=100)
needsCheck = models.BooleanField(default=True)
def __unicode__(self):
return self.name + (self.needsCheck and " (needs Check)" or "")
class Transaction(models.Model):
user = models.ForeignKey(User, unique=True)
transactionType = models.ForeignKey(TransactionType)
dateTime = models.DateTimeField()
amount = models.FloatField()
checked = models.BooleanField(default=False)
def __unicode__(self):
return "%s for user %s (%s), %schecked" % (self.amount, self.user, self.transactionType, (self.checked and "" or "not "))