Skip to content

Instantly share code, notes, and snippets.

@ollieglass
Last active December 11, 2015 23:38
Show Gist options
  • Save ollieglass/4677610 to your computer and use it in GitHub Desktop.
Save ollieglass/4677610 to your computer and use it in GitHub Desktop.
Transaction, Merchant and Category object model from my personal finance mini-hackathon http://ollieglass.com/2013/01/30/personal-finance-mini-hackathon
class Category(models.Model):
name = models.CharField(max_length=255)
class Merchant(models.Model):
name = models.CharField(max_length=255)
category = models.ForeignKey(Category, blank=True, null=True, db_index=True)
class Transaction(models.Model):
transaction_date = models.DateTimeField(db_index=True)
posting_date = models.DateTimeField(null=True)
billing_amount = models.FloatField(max_length=255)
merchant_raw = models.CharField(max_length=255)
merchant = models.ForeignKey(Merchant, db_index=True)
merchant_town = models.CharField(max_length=255)
merchant_county = models.CharField(max_length=255)
merchant_postcode = models.CharField(max_length=255)
reference_number = models.CharField(max_length=255)
debit_credit_flag = models.CharField(max_length=255)
sicmcc_code = models.CharField(max_length=255)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment