- MonthlyFixedExpense model: user, year, month, concept (FK), amount - Table shows all FixedExpenseConcept items from Settings - Amounts editable inline, auto-save on change via LiveView - Total updates in real-time without reloading - Clone feature to copy amounts from previous months
57 lines
1.3 KiB
Python
57 lines
1.3 KiB
Python
# Generated by Django 6.0 on 2026-03-18 13:24
|
|
|
|
import django.db.models.deletion
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("expenses", "0002_fixedexpenseconcept"),
|
|
("monthly", "0002_income"),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="MonthlyFixedExpense",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
("year", models.PositiveIntegerField()),
|
|
("month", models.PositiveSmallIntegerField()),
|
|
(
|
|
"amount",
|
|
models.DecimalField(decimal_places=2, default=0, max_digits=10),
|
|
),
|
|
(
|
|
"concept",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="monthly_entries",
|
|
to="expenses.fixedexpenseconcept",
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="monthly_fixed_expenses",
|
|
to=settings.AUTH_USER_MODEL,
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"ordering": ["concept__order"],
|
|
"unique_together": {("user", "year", "month", "concept")},
|
|
},
|
|
),
|
|
]
|