34 lines
703 B
Python
34 lines
703 B
Python
from django.db import models
|
|
from django.contrib.auth.models import User
|
|
|
|
class Account(models.Model):
|
|
|
|
ACCOUNT_TYPES = [
|
|
("gharzolhasaneh", "Gharzolhasaneh"),
|
|
("short_term", "Short Term"),
|
|
("current", "Current"),
|
|
]
|
|
|
|
user = models.ForeignKey(
|
|
User,
|
|
on_delete=models.CASCADE,
|
|
related_name="accounts"
|
|
)
|
|
|
|
account_number = models.CharField(
|
|
max_length=20,
|
|
unique=True
|
|
)
|
|
|
|
account_type = models.CharField(
|
|
max_length=20,
|
|
choices=ACCOUNT_TYPES,
|
|
default="gharzolhasaneh"
|
|
)
|
|
|
|
balance = models.IntegerField(
|
|
default=0
|
|
)
|
|
|
|
def __str__(self):
|
|
return self.account_number |