summaryrefslogtreecommitdiff
path: root/app/expenses/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-08-15 11:58:34 -0400
committerluxagraf <sng@luxagraf.net>2020-08-15 11:58:34 -0400
commitb66d000ee469539ce7aea557b612c0444177e36d (patch)
tree273547921dc6f9ded2a5681b82514c68e28ba448 /app/expenses/models.py
parentd3e57c1bd17ad3e71810235a672d4782136901a5 (diff)
archived old unused apps and migrated fieldnotes to posts
Diffstat (limited to 'app/expenses/models.py')
-rw-r--r--app/expenses/models.py62
1 files changed, 0 insertions, 62 deletions
diff --git a/app/expenses/models.py b/app/expenses/models.py
deleted file mode 100644
index fbcdd7a..0000000
--- a/app/expenses/models.py
+++ /dev/null
@@ -1,62 +0,0 @@
-from django.db import models
-from django.urls import reverse
-from django.utils import timezone
-
-CATS = (
- ('1', "Groceries"),
- ('2', "Restaurants"),
- ('3', "Camping"),
- ('4', "Petrol"),
- ('5', "Bus"),
- ('6', "Misc"),
-)
-
-
-class Trip(models.Model):
- name = models.CharField(max_length=200)
- slug = models.SlugField()
- start = models.DateTimeField(default=timezone.now, blank=True, null=True)
- end = models.DateTimeField(default=timezone.now, blank=True, null=True)
- dek = models.TextField(null=True, blank=True)
-
- def __str__(self):
- return self.name
-
- def get_absolute_url(self):
- return reverse("expenses:list_expense", kwargs={"slug": self.slug})
-
-class Month(models.Model):
- name = models.CharField(max_length=200)
- year = models.IntegerField()
- date = models.DateTimeField(default=timezone.now)
- notes = models.TextField(null=True, blank=True)
-
- def __str__(self):
- return "%s %s" %(self.name, self.year)
-
-class LuxExpense(models.Model):
- category = models.CharField(max_length=2, choices=CATS, default=1)
- amount = models.DecimalField(max_digits=8, decimal_places=2)
- month = models.ForeignKey(Month, on_delete=models.CASCADE, null=True)
-
- def __str__(self):
- return '%s-%s' %(self.month, self.get_category_display())
-
-
-
-class Expense(models.Model):
- name = models.CharField(max_length=200)
- amount = models.DecimalField(max_digits=8, decimal_places=2)
- date = models.DateTimeField(default=timezone.now)
- notes = models.TextField(null=True, blank=True)
- category = models.CharField(max_length=2, choices=CATS, default=1)
- trip = models.ForeignKey(Trip, on_delete=models.CASCADE, null=True)
-
- class Meta:
- ordering = ('-date',)
-
- def __str__(self):
- return self.name
-
- def date_month(self):
- return self.date.strftime("%b %Y")