Compare commits

..

No commits in common. "84879b89d1e984b0a1869f998a5314666f4414d5" and "b9dc545ebbff7f0ce78fe102518c9fa5294d5319" have entirely different histories.

6 changed files with 4 additions and 119 deletions

1
.gitignore vendored
View File

@ -9,4 +9,3 @@
__pycache__/ __pycache__/
# Tests: # Tests:
.coverage .coverage
*.sqlite3

View File

@ -1,12 +0,0 @@
"""
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')
application = get_asgi_application()

View File

@ -31,7 +31,6 @@ ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'django_stockfin_db',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',

View File

@ -1,12 +0,0 @@
"""
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_project.settings')
application = get_wsgi_application()

View File

@ -1,8 +1,3 @@
from django.contrib import admin from django.contrib import admin
from django_stockfin_db.models import FinancialPosition # Register your models here.
@admin.register(FinancialPosition)
class FinancialPositionAdmin(admin.ModelAdmin):
pass

View File

@ -1,28 +1,8 @@
from django.db.models import Model from django.db.models import Model, CharField, ForeignKey, TextChoices, PROTECT
from django.db.models.fields import CharField, FloatField, BooleanField, DateField, DateTimeField
from django.db.models.fields.related import ForeignKey
from django.db.models.deletion import PROTECT, CASCADE
from django.db.models.enums import TextChoices
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AbstractBaseModel(Model): class FinancialPosition(Model):
date_created = DateTimeField(
auto_now_add=True,
verbose_name=_("Time of creation")
)
date_modified = DateTimeField(
auto_now=True,
verbose_name=_("Time of last modification")
)
class Meta:
abstract = True
class FinancialPosition(AbstractBaseModel):
class FinStmt(TextChoices): class FinStmt(TextChoices):
BS = 'BS', _("Balance Sheet") BS = 'BS', _("Balance Sheet")
@ -47,67 +27,3 @@ class FinancialPosition(AbstractBaseModel):
blank=True, blank=True,
verbose_name=_("Parent position") verbose_name=_("Parent position")
) )
class ReportingPeriod(AbstractBaseModel):
date_end = DateField(
db_index=True,
verbose_name=_("Period end date")
)
date_start = DateField(
db_index=True,
verbose_name=_("Period start date")
)
verified = BooleanField(
default=False,
verbose_name=_("Exact dates verified")
)
class Company(AbstractBaseModel):
symbol = CharField(
max_length=16,
unique=True,
verbose_name=_("Stock ticker symbol")
)
class Meta:
verbose_name_plural = _("Companies")
class CompanyName(AbstractBaseModel):
company = ForeignKey(
to=Company,
on_delete=CASCADE
)
name = CharField(
max_length=1024,
db_index=True,
verbose_name=_("Name")
)
name_since = DateField(
db_index=True,
verbose_name=_("Has this name since")
)
class Figure(AbstractBaseModel):
position = ForeignKey(
to=FinancialPosition,
on_delete=PROTECT
)
period = ForeignKey(
to=ReportingPeriod,
on_delete=PROTECT
)
company = ForeignKey(
to=Company,
on_delete=PROTECT
)
value = FloatField(
verbose_name=_("Figure on financial statement")
)