Add Account, Stack, Transaction models
This commit is contained in:
parent
475f686dfe
commit
c790f39741
|
@ -1,3 +1,30 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
# Create your models here.
|
import uuid
|
||||||
|
|
||||||
|
class Account(models.Model):
|
||||||
|
users = models.ManyToManyField(User)
|
||||||
|
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
name = models.CharField(max_length=128)
|
||||||
|
details = models.TextField()
|
||||||
|
income = models.DecimalField(max_digits=12, decimal_places=2)
|
||||||
|
expenses = models.DecimalField(max_digits=12, decimal_places=2)
|
||||||
|
|
||||||
|
|
||||||
|
class Stack(models.Model):
|
||||||
|
account = models.ForeignKey(Account, related_name='stacks', on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
name = models.CharField(max_length=128)
|
||||||
|
details = models.TextField()
|
||||||
|
amount = models.DecimalField(max_digits=12, decimal_places=2)
|
||||||
|
|
||||||
|
|
||||||
|
class Transaction(models.Model):
|
||||||
|
stack = models.ForeignKey(Stack, related_name='transactions', on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
|
details = models.TextField()
|
||||||
|
amount = models.DecimalField(max_digits=12, decimal_places=2)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user