Add form for transactions
This commit is contained in:
parent
4ef99f4ef0
commit
5339a725f2
4 changed files with 26 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
import uuid
|
||||
from django.db import models
|
||||
from django.forms import ModelForm
|
||||
|
||||
|
||||
class Transaction(models.Model):
|
||||
|
@ -13,6 +14,12 @@ class Transaction(models.Model):
|
|||
return f"{self.date} {self.name}: {self.value}€"
|
||||
|
||||
|
||||
class TransactionForm(ModelForm):
|
||||
class Meta:
|
||||
model = Transaction
|
||||
fields = ["name", "description", "value", "date"]
|
||||
|
||||
|
||||
class Invoice(models.Model):
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
name = models.CharField(max_length=256)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue