diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/budget/migrations/0011_luxpaymentmethod_alter_luxfixedmonthly_amount_and_more.py | 31 | ||||
-rw-r--r-- | app/budget/models.py | 10 |
2 files changed, 40 insertions, 1 deletions
diff --git a/app/budget/migrations/0011_luxpaymentmethod_alter_luxfixedmonthly_amount_and_more.py b/app/budget/migrations/0011_luxpaymentmethod_alter_luxfixedmonthly_amount_and_more.py new file mode 100644 index 0000000..4186c52 --- /dev/null +++ b/app/budget/migrations/0011_luxpaymentmethod_alter_luxfixedmonthly_amount_and_more.py @@ -0,0 +1,31 @@ +# Generated by Django 4.0.6 on 2022-11-13 11:11 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('budget', '0010_luxfixedmonthly_amount'), + ] + + operations = [ + migrations.CreateModel( + name='LuxPaymentMethod', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=200)), + ], + ), + migrations.AlterField( + model_name='luxfixedmonthly', + name='amount', + field=models.DecimalField(decimal_places=2, max_digits=6), + ), + migrations.AddField( + model_name='luxfixedmonthly', + name='payment_method', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='budget.luxpaymentmethod'), + ), + ] diff --git a/app/budget/models.py b/app/budget/models.py index 439570f..512b019 100644 --- a/app/budget/models.py +++ b/app/budget/models.py @@ -22,11 +22,19 @@ class LuxSpendingCategory(models.Model): return self.name +class LuxPaymentMethod(models.Model): + name = models.CharField(max_length=200) + + def __str__(self): + return self.name + + class LuxFixedMonthly(models.Model): name = models.CharField(max_length=200) - amount = models.DecimalField(null=True, max_digits=6, decimal_places=2) + amount = models.DecimalField(max_digits=6, decimal_places=2) source = models.ForeignKey(LuxSource, on_delete=models.CASCADE) category = models.ForeignKey(LuxSpendingCategory, on_delete=models.CASCADE) + payment_method = models.ForeignKey(LuxPaymentMethod, null=True, on_delete=models.CASCADE) date_recorded = models.DateTimeField(auto_now_add=True) def __str__(self): |