Add real date field to transactions

This commit is contained in:
Edgar P. Burkhart 2022-05-22 13:36:43 +02:00
parent 83aefe1f84
commit 215787e204
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 20 additions and 1 deletions

View file

@ -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),
),
]

View file

@ -31,6 +31,7 @@ class Transaction(models.Model):
description = models.TextField(null=True, blank=True) description = models.TextField(null=True, blank=True)
value = models.DecimalField(max_digits=12, decimal_places=2, default=0) value = models.DecimalField(max_digits=12, decimal_places=2, default=0)
date = models.DateField(default=date.today) date = models.DateField(default=date.today)
real_date = models.DateField(blank=True, null=True)
trader = models.CharField(max_length=128, blank=True, null=True) trader = models.CharField(max_length=128, blank=True, null=True)
category = models.ForeignKey( category = models.ForeignKey(
Category, on_delete=models.SET_NULL, blank=True, null=True Category, on_delete=models.SET_NULL, blank=True, null=True
@ -49,7 +50,7 @@ class Transaction(models.Model):
class TransactionForm(ModelForm): class TransactionForm(ModelForm):
class Meta: class Meta:
model = Transaction model = Transaction
fields = ["date", "name", "value", "trader", "category", "description"] fields = ["date", "name", "value", "trader", "category", "real_date", "description"]
class Invoice(models.Model): class Invoice(models.Model):