summaryrefslogtreecommitdiff
path: root/app/expenses/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/expenses/models.py')
-rw-r--r--app/expenses/models.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/app/expenses/models.py b/app/expenses/models.py
new file mode 100644
index 0000000..a01b8d7
--- /dev/null
+++ b/app/expenses/models.py
@@ -0,0 +1,31 @@
+from django.db import models
+from django.template.defaultfilters import slugify
+import datetime
+
+CATS = (
+ ('1', "Yellowstone"),
+ ('2', "Suburban"),
+ ('3', "Groceries"),
+ ('4', "Lodging"),
+ ('5', "Camping"),
+ ('6', "Restaurants"),
+ ('7', "Petrol"),
+ ('8', "Misc"),
+)
+
+class Expense(models.Model):
+ name = models.CharField(max_length=200)
+ amount = models.DecimalField(max_digits=8, decimal_places=2)
+ date = models.DateTimeField(default=datetime.date.today())
+ notes = models.TextField(null=True, blank=True)
+ category = models.CharField(max_length=2, choices=CATS, default=1)
+
+ class Meta:
+ ordering = ('-date',)
+
+ def __str__(self):
+ return self.name
+
+ def date_month(self):
+ return self.date.strftime("%b %Y")
+