From b9dc545ebbff7f0ce78fe102518c9fa5294d5319 Mon Sep 17 00:00:00 2001 From: Maximilian Fajnberg Date: Sun, 2 Jan 2022 00:06:06 +0100 Subject: [PATCH] first model draft --- src/django_stockfin_db/models.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/django_stockfin_db/models.py b/src/django_stockfin_db/models.py index 71a8362..91094e1 100644 --- a/src/django_stockfin_db/models.py +++ b/src/django_stockfin_db/models.py @@ -1,3 +1,29 @@ -from django.db import models +from django.db.models import Model, CharField, ForeignKey, TextChoices, PROTECT +from django.utils.translation import gettext_lazy as _ -# Create your models here. + +class FinancialPosition(Model): + + class FinStmt(TextChoices): + BS = 'BS', _("Balance Sheet") + IS = 'IS', _("Income Statement") + CF = 'CF', _("Cash Flow Statement") + + financial_statement = CharField( + max_length=2, + db_index=True, + choices=FinStmt.choices, + verbose_name=_("Financial statement") + ) + name = CharField( + max_length=255, + db_index=True, + verbose_name=_("Position name") + ) + parent = ForeignKey( + to='self', + on_delete=PROTECT, + null=True, + blank=True, + verbose_name=_("Parent position") + )