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 "))