From 230febc2c3fd689bf3aa5fd0f33a1a3e69742eb8 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sat, 12 Nov 2022 12:17:10 -0600 Subject: bdgt: renamed cat to category to finish migration --- app/budget/models.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'app/budget') 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: -- cgit v1.2.3-70-g09d2