349 lines
12 KiB
Python
349 lines
12 KiB
Python
# Generated by Django 4.1.4 on 2023-04-20 15:32
|
|
|
|
import datetime
|
|
import uuid
|
|
|
|
import django.contrib.postgres.operations
|
|
import django.core.validators
|
|
import django.db.models.deletion
|
|
import media.utils
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
initial = True
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
django.contrib.postgres.operations.TrigramExtension(),
|
|
django.contrib.postgres.operations.UnaccentExtension(),
|
|
migrations.CreateModel(
|
|
name="Category",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
primary_key=True,
|
|
serialize=False,
|
|
),
|
|
),
|
|
(
|
|
"name",
|
|
models.CharField(
|
|
default="Category", max_length=64, verbose_name="Name"
|
|
),
|
|
),
|
|
("budget", models.BooleanField(default=True, verbose_name="Budget")),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
editable=False,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to=settings.AUTH_USER_MODEL,
|
|
verbose_name="User",
|
|
),
|
|
),
|
|
(
|
|
"icon",
|
|
models.SlugField(
|
|
default="folder", max_length=24, verbose_name="Icon"
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"ordering": ["name"],
|
|
"verbose_name": "Category",
|
|
"verbose_name_plural": "Categories",
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="Account",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
primary_key=True,
|
|
serialize=False,
|
|
),
|
|
),
|
|
(
|
|
"name",
|
|
models.CharField(
|
|
default="Account", max_length=64, verbose_name="Name"
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
editable=False,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to=settings.AUTH_USER_MODEL,
|
|
verbose_name="User",
|
|
),
|
|
),
|
|
("default", models.BooleanField(default=False, verbose_name="Default")),
|
|
(
|
|
"icon",
|
|
models.SlugField(
|
|
default="bank", max_length=24, verbose_name="Icon"
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "Account",
|
|
"verbose_name_plural": "Accounts",
|
|
"ordering": ["-default", "name"],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="Snapshot",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
primary_key=True,
|
|
serialize=False,
|
|
),
|
|
),
|
|
(
|
|
"date",
|
|
models.DateField(
|
|
default=datetime.date.today, verbose_name="End date"
|
|
),
|
|
),
|
|
(
|
|
"value",
|
|
models.DecimalField(
|
|
decimal_places=2,
|
|
default=0,
|
|
max_digits=12,
|
|
verbose_name="End value",
|
|
),
|
|
),
|
|
(
|
|
"file",
|
|
models.FileField(
|
|
blank=True,
|
|
default="",
|
|
max_length=256,
|
|
upload_to=media.utils.get_path,
|
|
validators=[
|
|
django.core.validators.FileExtensionValidator(["pdf"])
|
|
],
|
|
verbose_name="File",
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
editable=False,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to=settings.AUTH_USER_MODEL,
|
|
verbose_name="User",
|
|
),
|
|
),
|
|
(
|
|
"account",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to="main.account",
|
|
verbose_name="Account",
|
|
),
|
|
),
|
|
(
|
|
"start_date",
|
|
models.DateField(
|
|
default=datetime.date.today, verbose_name="Start date"
|
|
),
|
|
),
|
|
(
|
|
"start_value",
|
|
models.DecimalField(
|
|
decimal_places=2,
|
|
default=0,
|
|
max_digits=12,
|
|
verbose_name="Start value",
|
|
),
|
|
),
|
|
(
|
|
"diff",
|
|
models.DecimalField(
|
|
decimal_places=2,
|
|
default=0,
|
|
editable=False,
|
|
max_digits=12,
|
|
verbose_name="Difference",
|
|
),
|
|
),
|
|
(
|
|
"sum",
|
|
models.DecimalField(
|
|
decimal_places=2,
|
|
default=0,
|
|
editable=False,
|
|
max_digits=12,
|
|
verbose_name="Transaction difference",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"ordering": ["-date", "account"],
|
|
"verbose_name": "Statement",
|
|
"verbose_name_plural": "Statements",
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="Transaction",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
primary_key=True,
|
|
serialize=False,
|
|
),
|
|
),
|
|
(
|
|
"name",
|
|
models.CharField(
|
|
default="Transaction", max_length=256, verbose_name="Name"
|
|
),
|
|
),
|
|
(
|
|
"description",
|
|
models.TextField(blank=True, null=True, verbose_name="Description"),
|
|
),
|
|
(
|
|
"value",
|
|
models.DecimalField(
|
|
decimal_places=2, default=0, max_digits=12, verbose_name="Value"
|
|
),
|
|
),
|
|
(
|
|
"date",
|
|
models.DateField(default=datetime.date.today, verbose_name="Date"),
|
|
),
|
|
(
|
|
"trader",
|
|
models.CharField(
|
|
blank=True, max_length=128, null=True, verbose_name="Trader"
|
|
),
|
|
),
|
|
(
|
|
"category",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
to="main.category",
|
|
verbose_name="Category",
|
|
),
|
|
),
|
|
(
|
|
"real_date",
|
|
models.DateField(blank=True, null=True, verbose_name="Real date"),
|
|
),
|
|
(
|
|
"payment",
|
|
models.CharField(
|
|
blank=True, max_length=128, null=True, verbose_name="Payment"
|
|
),
|
|
),
|
|
(
|
|
"account",
|
|
models.ForeignKey(
|
|
editable=False,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to="main.account",
|
|
verbose_name="Account",
|
|
),
|
|
),
|
|
(
|
|
"snapshot",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to="main.snapshot",
|
|
verbose_name="Statement",
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
editable=False,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to=settings.AUTH_USER_MODEL,
|
|
verbose_name="User",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"ordering": ["-date", "snapshot"],
|
|
"verbose_name": "Transaction",
|
|
"verbose_name_plural": "Transactions",
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="Invoice",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.UUIDField(
|
|
default=uuid.uuid4,
|
|
editable=False,
|
|
primary_key=True,
|
|
serialize=False,
|
|
),
|
|
),
|
|
(
|
|
"name",
|
|
models.CharField(
|
|
default="Invoice", max_length=256, verbose_name="Name"
|
|
),
|
|
),
|
|
(
|
|
"file",
|
|
models.FileField(
|
|
max_length=128,
|
|
upload_to=media.utils.get_path,
|
|
validators=[
|
|
django.core.validators.FileExtensionValidator(["pdf"])
|
|
],
|
|
verbose_name="File",
|
|
),
|
|
),
|
|
(
|
|
"transaction",
|
|
models.ForeignKey(
|
|
editable=False,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to="main.transaction",
|
|
),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
editable=False,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to=settings.AUTH_USER_MODEL,
|
|
verbose_name="User",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"ordering": ["transaction", "name"],
|
|
"verbose_name": "Invoice",
|
|
"verbose_name_plural": "Invoices",
|
|
},
|
|
),
|
|
]
|