diff options
Diffstat (limited to 'app/budget/models.py')
-rw-r--r-- | app/budget/models.py | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/app/budget/models.py b/app/budget/models.py index 6d1d113..b5b00a4 100644 --- a/app/budget/models.py +++ b/app/budget/models.py @@ -48,24 +48,13 @@ class LuxPurchaseStatsManager(models.Manager): start_date = datetime.date(timezone.now().year, start_month, 1) last_day = calendar.monthrange(timezone.now().year, month)[1] end_date = datetime.date(timezone.now().year, month, last_day) - return self.filter(date_recorded__range=(start_date, end_date)).filter(cat=cat).aggregate(Sum('amount')) + return self.filter(date_recorded__range=(start_date, end_date)).filter(category=cat).aggregate(Sum('amount')) class LuxPurchase(models.Model): amount = models.DecimalField(max_digits=6, decimal_places=2) source = models.ForeignKey(LuxSource, on_delete=models.CASCADE) - CATEGORY = ( - (0, 'Grocery & Home'), - (1, 'Gas'), - (2, 'Bus'), - (3, 'Lodging'), - (4, 'Books'), - (5, 'Clothes'), - (6, 'Eating Out'), - (7, 'Misc'), - ) - category = models.IntegerField(choices=CATEGORY, default=0) - cat = models.ForeignKey(LuxSpendingCategory, null=True, on_delete=models.CASCADE) + category = models.ForeignKey(LuxSpendingCategory, null=True, on_delete=models.CASCADE) date_recorded = models.DateTimeField(auto_now_add=True) class Meta: |