27 lines
515 B
Python
27 lines
515 B
Python
from django.db import models
|
|
|
|
|
|
class Transaction(models.Model):
|
|
|
|
account = models.ForeignKey(
|
|
"accounts.Account",
|
|
on_delete=models.CASCADE,
|
|
related_name="transactions"
|
|
)
|
|
|
|
transaction_type = models.CharField(
|
|
max_length=20
|
|
)
|
|
|
|
amount = models.DecimalField(
|
|
max_digits=12,
|
|
decimal_places=2
|
|
)
|
|
|
|
created_at = models.DateTimeField(
|
|
auto_now_add=True
|
|
)
|
|
|
|
|
|
def __str__(self):
|
|
return f"{self.transaction_type} - {self.amount}" |