From b45150d4ff9e28e6104b157d3b6530c804a8e1f1 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sun, 22 May 2022 13:52:09 +0200 Subject: [PATCH] Added payment field to transaction --- .../migrations/0003_transaction_real_date.py | 6 +++--- .../migrations/0004_transaction_payment.py | 18 ++++++++++++++++++ nummi/main/models.py | 12 +++++++++++- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 nummi/main/migrations/0004_transaction_payment.py diff --git a/nummi/main/migrations/0003_transaction_real_date.py b/nummi/main/migrations/0003_transaction_real_date.py index fd79bda..dfa0a25 100644 --- a/nummi/main/migrations/0003_transaction_real_date.py +++ b/nummi/main/migrations/0003_transaction_real_date.py @@ -6,13 +6,13 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('main', '0002_alter_snapshot_date_alter_snapshot_diff'), + ("main", "0002_alter_snapshot_date_alter_snapshot_diff"), ] operations = [ migrations.AddField( - model_name='transaction', - name='real_date', + model_name="transaction", + name="real_date", field=models.DateField(blank=True, null=True), ), ] diff --git a/nummi/main/migrations/0004_transaction_payment.py b/nummi/main/migrations/0004_transaction_payment.py new file mode 100644 index 0000000..f613d7e --- /dev/null +++ b/nummi/main/migrations/0004_transaction_payment.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.4 on 2022-05-22 11:51 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("main", "0003_transaction_real_date"), + ] + + operations = [ + migrations.AddField( + model_name="transaction", + name="payment", + field=models.CharField(blank=True, max_length=128, null=True), + ), + ] diff --git a/nummi/main/models.py b/nummi/main/models.py index 1a1bd8b..bd4b412 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -33,6 +33,7 @@ class Transaction(models.Model): date = models.DateField(default=date.today) real_date = models.DateField(blank=True, null=True) trader = models.CharField(max_length=128, blank=True, null=True) + payment = models.CharField(max_length=128, blank=True, null=True) category = models.ForeignKey( Category, on_delete=models.SET_NULL, blank=True, null=True ) @@ -50,7 +51,16 @@ class Transaction(models.Model): class TransactionForm(ModelForm): class Meta: model = Transaction - fields = ["date", "name", "value", "trader", "category", "real_date", "description"] + fields = [ + "date", + "name", + "value", + "trader", + "category", + "real_date", + "payment", + "description", + ] class Invoice(models.Model):