From 215787e2048f2d61f67bbba2f3b52db0afcf297e Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sun, 22 May 2022 13:36:43 +0200 Subject: [PATCH] Add real date field to transactions --- .../migrations/0003_transaction_real_date.py | 18 ++++++++++++++++++ nummi/main/models.py | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 nummi/main/migrations/0003_transaction_real_date.py diff --git a/nummi/main/migrations/0003_transaction_real_date.py b/nummi/main/migrations/0003_transaction_real_date.py new file mode 100644 index 0000000..fd79bda --- /dev/null +++ b/nummi/main/migrations/0003_transaction_real_date.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.4 on 2022-05-22 11:35 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('main', '0002_alter_snapshot_date_alter_snapshot_diff'), + ] + + operations = [ + migrations.AddField( + model_name='transaction', + name='real_date', + field=models.DateField(blank=True, null=True), + ), + ] diff --git a/nummi/main/models.py b/nummi/main/models.py index d4cfcf0..1a1bd8b 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -31,6 +31,7 @@ class Transaction(models.Model): description = models.TextField(null=True, blank=True) value = models.DecimalField(max_digits=12, decimal_places=2, default=0) date = models.DateField(default=date.today) + real_date = models.DateField(blank=True, null=True) trader = models.CharField(max_length=128, blank=True, null=True) category = models.ForeignKey( Category, on_delete=models.SET_NULL, blank=True, null=True @@ -49,7 +50,7 @@ class Transaction(models.Model): class TransactionForm(ModelForm): class Meta: model = Transaction - fields = ["date", "name", "value", "trader", "category", "description"] + fields = ["date", "name", "value", "trader", "category", "real_date", "description"] class Invoice(models.Model):