diff options
Diffstat (limited to 'app/budget/models.py')
-rw-r--r-- | app/budget/models.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/budget/models.py b/app/budget/models.py new file mode 100644 index 0000000..acf2b69 --- /dev/null +++ b/app/budget/models.py @@ -0,0 +1,31 @@ +from django.db import models + +class LuxSource(models.Model): + name = models.CharField(max_length=200) + date_recorded = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.name + +class LuxPurchase(models.Model): + amount = models.IntegerField() + source = models.ForeignKey(LuxSource, on_delete=models.CASCADE) + CATEGORY = ( + (0, 'Grocery and Home'), + (1, 'Gas'), + (2, 'Bus'), + (3, 'Lodging'), + (4, 'Books'), + (5, 'Clothes'), + (6, 'Eating Out'), + (7, 'Misc'), + ) + category = models.IntegerField(choices=CATEGORY, default=0) + date_recorded = models.DateTimeField(auto_now_add=True) + + class Meta: + ordering = ('-date_recorded',) + + def __str__(self): + return self.name + |