2023-04-20 17:34:51 +02:00
|
|
|
# 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
|
2023-04-22 11:16:42 +02:00
|
|
|
import media.utils
|
2023-04-20 17:34:51 +02:00
|
|
|
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 = [
|
2023-04-20 18:01:01 +02:00
|
|
|
django.contrib.postgres.operations.TrigramExtension(),
|
|
|
|
django.contrib.postgres.operations.UnaccentExtension(),
|
2023-04-20 17:34:51 +02:00
|
|
|
migrations.CreateModel(
|
|
|
|
name="Category",
|
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.UUIDField(
|
|
|
|
default=uuid.uuid4,
|
|
|
|
editable=False,
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"name",
|
|
|
|
models.CharField(
|
2023-04-20 18:01:01 +02:00
|
|
|
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",
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"icon",
|
2023-04-20 18:01:01 +02:00
|
|
|
models.SlugField(
|
|
|
|
default="folder", max_length=24, verbose_name="Icon"
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
options={
|
|
|
|
"ordering": ["name"],
|
2023-04-20 18:01:01 +02:00
|
|
|
"verbose_name": "Category",
|
|
|
|
"verbose_name_plural": "Categories",
|
2023-04-20 17:34:51 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2023-04-20 18:01:01 +02:00
|
|
|
name="Account",
|
2023-04-20 17:34:51 +02:00
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.UUIDField(
|
|
|
|
default=uuid.uuid4,
|
|
|
|
editable=False,
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"name",
|
|
|
|
models.CharField(
|
2023-04-20 18:01:01 +02:00
|
|
|
default="Account", max_length=64, verbose_name="Name"
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"user",
|
2023-04-20 17:34:51 +02:00
|
|
|
models.ForeignKey(
|
2023-04-20 18:01:01 +02:00
|
|
|
editable=False,
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
to=settings.AUTH_USER_MODEL,
|
|
|
|
verbose_name="User",
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
2023-04-20 18:01:01 +02:00
|
|
|
("default", models.BooleanField(default=False, verbose_name="Default")),
|
2023-04-20 17:34:51 +02:00
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"icon",
|
|
|
|
models.SlugField(
|
|
|
|
default="bank", max_length=24, verbose_name="Icon"
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
options={
|
2023-04-20 18:01:01 +02:00
|
|
|
"verbose_name": "Account",
|
|
|
|
"verbose_name_plural": "Accounts",
|
|
|
|
"ordering": ["-default", "name"],
|
2023-04-20 17:34:51 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2023-04-20 18:01:01 +02:00
|
|
|
name="Snapshot",
|
2023-04-20 17:34:51 +02:00
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.UUIDField(
|
|
|
|
default=uuid.uuid4,
|
|
|
|
editable=False,
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"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",
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"file",
|
|
|
|
models.FileField(
|
2023-04-20 18:01:01 +02:00
|
|
|
blank=True,
|
|
|
|
default="",
|
|
|
|
max_length=256,
|
2023-04-22 11:16:42 +02:00
|
|
|
upload_to=media.utils.get_path,
|
2023-04-20 17:34:51 +02:00
|
|
|
validators=[
|
|
|
|
django.core.validators.FileExtensionValidator(["pdf"])
|
|
|
|
],
|
2023-04-20 18:01:01 +02:00
|
|
|
verbose_name="File",
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"user",
|
2023-04-20 17:34:51 +02:00
|
|
|
models.ForeignKey(
|
2023-04-20 18:01:01 +02:00
|
|
|
editable=False,
|
2023-04-20 17:34:51 +02:00
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
2023-04-20 18:01:01 +02:00
|
|
|
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",
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
options={
|
2023-04-20 18:01:01 +02:00
|
|
|
"ordering": ["-date", "account"],
|
|
|
|
"verbose_name": "Statement",
|
|
|
|
"verbose_name_plural": "Statements",
|
2023-04-20 17:34:51 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2023-04-20 18:01:01 +02:00
|
|
|
name="Transaction",
|
2023-04-20 17:34:51 +02:00
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.UUIDField(
|
|
|
|
default=uuid.uuid4,
|
|
|
|
editable=False,
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"name",
|
|
|
|
models.CharField(
|
|
|
|
default="Transaction", max_length=256, verbose_name="Name"
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
2023-04-20 18:01:01 +02:00
|
|
|
(
|
|
|
|
"description",
|
|
|
|
models.TextField(blank=True, null=True, verbose_name="Description"),
|
|
|
|
),
|
2023-04-20 17:34:51 +02:00
|
|
|
(
|
|
|
|
"value",
|
|
|
|
models.DecimalField(
|
2023-04-20 18:01:01 +02:00
|
|
|
decimal_places=2, default=0, max_digits=12, verbose_name="Value"
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"date",
|
|
|
|
models.DateField(default=datetime.date.today, verbose_name="Date"),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"trader",
|
|
|
|
models.CharField(
|
|
|
|
blank=True, max_length=128, null=True, verbose_name="Trader"
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"category",
|
|
|
|
models.ForeignKey(
|
2023-04-20 17:34:51 +02:00
|
|
|
blank=True,
|
|
|
|
null=True,
|
|
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
2023-04-20 18:01:01 +02:00
|
|
|
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,
|
2023-04-20 17:34:51 +02:00
|
|
|
to="main.snapshot",
|
2023-04-20 18:01:01 +02:00
|
|
|
verbose_name="Statement",
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"user",
|
|
|
|
models.ForeignKey(
|
|
|
|
editable=False,
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
to=settings.AUTH_USER_MODEL,
|
|
|
|
verbose_name="User",
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
options={
|
2023-04-20 18:01:01 +02:00
|
|
|
"ordering": ["-date", "snapshot"],
|
|
|
|
"verbose_name": "Transaction",
|
|
|
|
"verbose_name_plural": "Transactions",
|
2023-04-20 17:34:51 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2023-04-20 18:01:01 +02:00
|
|
|
name="Invoice",
|
2023-04-20 17:34:51 +02:00
|
|
|
fields=[
|
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.UUIDField(
|
|
|
|
default=uuid.uuid4,
|
|
|
|
editable=False,
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"name",
|
|
|
|
models.CharField(
|
2023-04-20 18:01:01 +02:00
|
|
|
default="Invoice", max_length=256, verbose_name="Name"
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"file",
|
|
|
|
models.FileField(
|
|
|
|
max_length=128,
|
2023-04-22 11:16:42 +02:00
|
|
|
upload_to=media.utils.get_path,
|
2023-04-20 18:01:01 +02:00
|
|
|
validators=[
|
|
|
|
django.core.validators.FileExtensionValidator(["pdf"])
|
|
|
|
],
|
|
|
|
verbose_name="File",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"transaction",
|
2023-04-20 17:34:51 +02:00
|
|
|
models.ForeignKey(
|
|
|
|
editable=False,
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
2023-04-20 18:01:01 +02:00
|
|
|
to="main.transaction",
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
2023-04-20 18:01:01 +02:00
|
|
|
"user",
|
|
|
|
models.ForeignKey(
|
|
|
|
editable=False,
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
to=settings.AUTH_USER_MODEL,
|
|
|
|
verbose_name="User",
|
2023-04-20 17:34:51 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
options={
|
|
|
|
"ordering": ["transaction", "name"],
|
|
|
|
"verbose_name": "Invoice",
|
|
|
|
"verbose_name_plural": "Invoices",
|
|
|
|
},
|
|
|
|
),
|
|
|
|
]
|