- PlannedExpense model: year, month, concept, amount - CRUD via LiveView in Year page (add form + delete) - Tables grouped by month with totals - Variable expenses line in Year charts includes planned expenses - Month page shows read-only planned expenses table for the month - Month end calculations include planned expenses in totals
15 lines
403 B
Python
15 lines
403 B
Python
from django.db import models
|
|
|
|
|
|
class PlannedExpense(models.Model):
|
|
year = models.PositiveIntegerField()
|
|
month = models.PositiveSmallIntegerField()
|
|
concept = models.CharField(max_length=255)
|
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
|
|
class Meta:
|
|
ordering = ["year", "month", "concept"]
|
|
|
|
def __str__(self):
|
|
return f"{self.concept} - {self.amount} ({self.month}/{self.year})"
|