Add flake8 linter
This commit is contained in:
parent
5a76d58894
commit
f3b355d76b
6 changed files with 990 additions and 22 deletions
|
@ -8,8 +8,14 @@ repos:
|
||||||
rev: 23.3.0
|
rev: 23.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
- repo: https://github.com/PyCQA/flake8
|
||||||
|
rev: "6.0.0"
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
args: ["--max-line-length=88", "--extend-ignore=E203"]
|
||||||
|
exclude: "migrations/"
|
||||||
- repo: https://github.com/Riverside-Healthcare/djLint
|
- repo: https://github.com/Riverside-Healthcare/djLint
|
||||||
rev: v1.23.1
|
rev: v1.23.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: djlint-django
|
- id: djlint-django
|
||||||
args: ["--reformat"]
|
args: ["--reformat"]
|
||||||
|
@ -18,4 +24,3 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: prettier
|
- id: prettier
|
||||||
types_or: ["css", "javascript"]
|
types_or: ["css", "javascript"]
|
||||||
exclude: "fontawesome/"
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.db import models, transaction
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from .models import Account, Category, Invoice, Snapshot, Transaction
|
from .models import Account, Category, Invoice, Snapshot, Transaction
|
||||||
|
@ -90,8 +89,8 @@ class SnapshotForm(NummiForm):
|
||||||
self.fields["account"].queryset = Account.objects.filter(user=_user)
|
self.fields["account"].queryset = Account.objects.filter(user=_user)
|
||||||
self.fields["transactions"] = forms.MultipleChoiceField(
|
self.fields["transactions"] = forms.MultipleChoiceField(
|
||||||
choices=(
|
choices=(
|
||||||
((transaction.id), transaction)
|
((_transaction.id), _transaction)
|
||||||
for transaction in Transaction.objects.filter(user=_user)
|
for _transaction in Transaction.objects.filter(user=_user)
|
||||||
),
|
),
|
||||||
label=_("Add transactions"),
|
label=_("Add transactions"),
|
||||||
required=False,
|
required=False,
|
||||||
|
|
|
@ -0,0 +1,978 @@
|
||||||
|
# Generated by Django 4.1.4 on 2023-04-20 15:13
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import re
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
import django.contrib.postgres.operations
|
||||||
|
import django.core.validators
|
||||||
|
import django.db.models.deletion
|
||||||
|
import main.utils
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
replaces = [
|
||||||
|
("main", "0001_initial"),
|
||||||
|
("main", "0002_alter_snapshot_date_alter_snapshot_diff"),
|
||||||
|
("main", "0003_transaction_real_date"),
|
||||||
|
("main", "0004_transaction_payment"),
|
||||||
|
("main", "0005_alter_category_name"),
|
||||||
|
("main", "0006_alter_category_options_alter_invoice_options_and_more"),
|
||||||
|
("main", "0007_snapshot_file_alter_invoice_file_alter_snapshot_date"),
|
||||||
|
("main", "0008_auto_20221221_1657"),
|
||||||
|
("main", "0009_alter_invoice_file_alter_invoice_transaction_and_more"),
|
||||||
|
("main", "0010_category_user_invoice_user_snapshot_user_and_more"),
|
||||||
|
("main", "0011_alter_category_user_alter_invoice_user_and_more"),
|
||||||
|
("main", "0012_alter_snapshot_date"),
|
||||||
|
("main", "0013_account_snapshot_account_transaction_account"),
|
||||||
|
("main", "0014_alter_account_icon"),
|
||||||
|
("main", "0015_alter_snapshot_options_remove_snapshot_diff_and_more"),
|
||||||
|
("main", "0016_alter_transaction_account_alter_transaction_snapshot"),
|
||||||
|
("main", "0017_alter_transaction_account"),
|
||||||
|
("main", "0018_snapshot_diff_alter_snapshot_account"),
|
||||||
|
("main", "0019_snapshot_sum"),
|
||||||
|
("main", "0020_alter_account_options_alter_snapshot_options_and_more"),
|
||||||
|
("main", "0021_alter_account_options_alter_category_options_and_more"),
|
||||||
|
("main", "0022_alter_account_icon_alter_category_icon"),
|
||||||
|
("main", "0023_auto_20221231_1741"),
|
||||||
|
("main", "0024_account_default"),
|
||||||
|
("main", "0025_alter_account_options_alter_invoice_options_and_more"),
|
||||||
|
("main", "0026_alter_account_uicon_alter_category_uicon"),
|
||||||
|
("main", "0027_remove_account_uicon_remove_category_uicon_and_more"),
|
||||||
|
("main", "0028_alter_account_icon_alter_category_icon"),
|
||||||
|
]
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Category",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.UUIDField(
|
||||||
|
default=uuid.uuid4,
|
||||||
|
editable=False,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"name",
|
||||||
|
models.CharField(
|
||||||
|
default="Catégorie", max_length=64, verbose_name="Nom"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"icon",
|
||||||
|
models.CharField(
|
||||||
|
default="folder", max_length=64, verbose_name="Icône"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("budget", models.BooleanField(default=True, verbose_name="Budget")),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"ordering": ["name"],
|
||||||
|
"verbose_name": "Catégorie",
|
||||||
|
"verbose_name_plural": "Catégories",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
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="Nom"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"description",
|
||||||
|
models.TextField(blank=True, null=True, verbose_name="Description"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"value",
|
||||||
|
models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=0,
|
||||||
|
max_digits=12,
|
||||||
|
verbose_name="Valeur",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"date",
|
||||||
|
models.DateField(default=datetime.date.today, verbose_name="Date"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"trader",
|
||||||
|
models.CharField(
|
||||||
|
blank=True, max_length=128, null=True, verbose_name="Commerçant"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"category",
|
||||||
|
models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
to="main.category",
|
||||||
|
verbose_name="Catégorie",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"real_date",
|
||||||
|
models.DateField(blank=True, null=True, verbose_name="Date réelle"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"payment",
|
||||||
|
models.CharField(
|
||||||
|
blank=True, max_length=128, null=True, verbose_name="Paiement"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"ordering": ["-date"],
|
||||||
|
"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="Facture", max_length=256, verbose_name="Nom"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"file",
|
||||||
|
models.FileField(
|
||||||
|
max_length=128,
|
||||||
|
upload_to="invoices/",
|
||||||
|
validators=[
|
||||||
|
django.core.validators.FileExtensionValidator(["pdf"])
|
||||||
|
],
|
||||||
|
verbose_name="Fichier",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"transaction",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.transaction",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"verbose_name": "Facture",
|
||||||
|
"verbose_name_plural": "Factures",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
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, unique=True, verbose_name="Date"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"value",
|
||||||
|
models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=0,
|
||||||
|
max_digits=12,
|
||||||
|
verbose_name="Valeur",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"diff",
|
||||||
|
models.DecimalField(
|
||||||
|
blank=True,
|
||||||
|
decimal_places=2,
|
||||||
|
editable=False,
|
||||||
|
max_digits=12,
|
||||||
|
null=True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"previous",
|
||||||
|
models.OneToOneField(
|
||||||
|
blank=True,
|
||||||
|
editable=False,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
to="main.snapshot",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"file",
|
||||||
|
models.FileField(
|
||||||
|
blank=True,
|
||||||
|
max_length=128,
|
||||||
|
null=True,
|
||||||
|
upload_to="snapshots/",
|
||||||
|
validators=[
|
||||||
|
django.core.validators.FileExtensionValidator(["pdf"])
|
||||||
|
],
|
||||||
|
verbose_name="Fichier",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"ordering": ["-date"],
|
||||||
|
"verbose_name": "Relevé",
|
||||||
|
"verbose_name_plural": "Relevés",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
django.contrib.postgres.operations.TrigramExtension(),
|
||||||
|
django.contrib.postgres.operations.UnaccentExtension(),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="invoice",
|
||||||
|
name="file",
|
||||||
|
field=models.FileField(
|
||||||
|
max_length=128,
|
||||||
|
upload_to=main.utils.get_path,
|
||||||
|
validators=[django.core.validators.FileExtensionValidator(["pdf"])],
|
||||||
|
verbose_name="Fichier",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="invoice",
|
||||||
|
name="transaction",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.transaction",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="file",
|
||||||
|
field=models.FileField(
|
||||||
|
blank=True,
|
||||||
|
default="",
|
||||||
|
max_length=256,
|
||||||
|
upload_to=main.utils.get_path,
|
||||||
|
validators=[django.core.validators.FileExtensionValidator(["pdf"])],
|
||||||
|
verbose_name="Fichier",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="category",
|
||||||
|
name="user",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="Utilisateur",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="invoice",
|
||||||
|
name="user",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="Utilisateur",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="user",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="Utilisateur",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="user",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="Utilisateur",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="date",
|
||||||
|
field=models.DateField(default=datetime.date.today, verbose_name="Date"),
|
||||||
|
),
|
||||||
|
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="Nom"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"icon",
|
||||||
|
models.CharField(
|
||||||
|
default="building-columns", max_length=64, verbose_name="Icône"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"user",
|
||||||
|
models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="Utilisateur",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"verbose_name": "Account",
|
||||||
|
"verbose_name_plural": "Accounts",
|
||||||
|
"ordering": ["name"],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="account",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
to="main.account",
|
||||||
|
verbose_name="Account",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="snapshot",
|
||||||
|
options={
|
||||||
|
"ordering": ["-date"],
|
||||||
|
"verbose_name": "Statement",
|
||||||
|
"verbose_name_plural": "Statements",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="diff",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="previous",
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="start_date",
|
||||||
|
field=models.DateField(
|
||||||
|
default=datetime.date.today, verbose_name="Start date"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="start_value",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2, default=0, max_digits=12, verbose_name="Start value"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="snapshot",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
to="main.snapshot",
|
||||||
|
verbose_name="Statement",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="date",
|
||||||
|
field=models.DateField(
|
||||||
|
default=datetime.date.today, verbose_name="End date"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="value",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2, default=0, max_digits=12, verbose_name="End value"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="account",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
editable=False,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
to="main.account",
|
||||||
|
verbose_name="Account",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="snapshot",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.snapshot",
|
||||||
|
verbose_name="Statement",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="account",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.account",
|
||||||
|
verbose_name="Account",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="diff",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=0,
|
||||||
|
editable=False,
|
||||||
|
max_digits=12,
|
||||||
|
verbose_name="Différence",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="account",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.account",
|
||||||
|
verbose_name="Account",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="sum",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=0,
|
||||||
|
editable=False,
|
||||||
|
max_digits=12,
|
||||||
|
verbose_name="Transaction difference",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="account",
|
||||||
|
options={
|
||||||
|
"ordering": ["name"],
|
||||||
|
"verbose_name": "Compte",
|
||||||
|
"verbose_name_plural": "Comptes",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="snapshot",
|
||||||
|
options={
|
||||||
|
"ordering": ["-date"],
|
||||||
|
"verbose_name": "Relevé",
|
||||||
|
"verbose_name_plural": "Relevés",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="account",
|
||||||
|
name="icon",
|
||||||
|
field=models.CharField(
|
||||||
|
default="building-columns",
|
||||||
|
max_length=64,
|
||||||
|
validators=[
|
||||||
|
django.core.validators.RegexValidator(
|
||||||
|
re.compile("^[-a-zA-Z0-9_]+\\Z"),
|
||||||
|
"Enter a valid “slug” consisting of letters, numbers, underscores or hyphens.",
|
||||||
|
"invalid",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
verbose_name="Icône",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="account",
|
||||||
|
name="name",
|
||||||
|
field=models.CharField(default="Compte", max_length=64, verbose_name="Nom"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="category",
|
||||||
|
name="icon",
|
||||||
|
field=models.CharField(
|
||||||
|
default="folder",
|
||||||
|
max_length=64,
|
||||||
|
validators=[
|
||||||
|
django.core.validators.RegexValidator(
|
||||||
|
re.compile("^[-a-zA-Z0-9_]+\\Z"),
|
||||||
|
"Enter a valid “slug” consisting of letters, numbers, underscores or hyphens.",
|
||||||
|
"invalid",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
verbose_name="Icône",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="account",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.account",
|
||||||
|
verbose_name="Compte",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="date",
|
||||||
|
field=models.DateField(
|
||||||
|
default=datetime.date.today, verbose_name="Date de fin"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="start_date",
|
||||||
|
field=models.DateField(
|
||||||
|
default=datetime.date.today, verbose_name="Date de début"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="start_value",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=0,
|
||||||
|
max_digits=12,
|
||||||
|
verbose_name="Valeur de début",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="sum",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=0,
|
||||||
|
editable=False,
|
||||||
|
max_digits=12,
|
||||||
|
verbose_name="Différence des transactions",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="value",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2, default=0, max_digits=12, verbose_name="Valeur de fin"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="account",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.account",
|
||||||
|
verbose_name="Compte",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="snapshot",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.snapshot",
|
||||||
|
verbose_name="Relevé",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="account",
|
||||||
|
options={
|
||||||
|
"ordering": ["name"],
|
||||||
|
"verbose_name": "Account",
|
||||||
|
"verbose_name_plural": "Accounts",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="category",
|
||||||
|
options={
|
||||||
|
"ordering": ["name"],
|
||||||
|
"verbose_name": "Category",
|
||||||
|
"verbose_name_plural": "Categories",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="invoice",
|
||||||
|
options={"verbose_name": "Invoice", "verbose_name_plural": "Invoices"},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="snapshot",
|
||||||
|
options={
|
||||||
|
"ordering": ["-date"],
|
||||||
|
"verbose_name": "Statement",
|
||||||
|
"verbose_name_plural": "Statements",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="account",
|
||||||
|
name="icon",
|
||||||
|
field=models.CharField(
|
||||||
|
default="building-columns",
|
||||||
|
max_length=64,
|
||||||
|
validators=[
|
||||||
|
django.core.validators.RegexValidator(
|
||||||
|
re.compile("^[-a-zA-Z0-9_]+\\Z"),
|
||||||
|
"Enter a valid “slug” consisting of letters, numbers, underscores or hyphens.",
|
||||||
|
"invalid",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
verbose_name="Icon",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="account",
|
||||||
|
name="name",
|
||||||
|
field=models.CharField(
|
||||||
|
default="Account", max_length=64, verbose_name="Name"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="account",
|
||||||
|
name="user",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="User",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="category",
|
||||||
|
name="icon",
|
||||||
|
field=models.CharField(
|
||||||
|
default="folder",
|
||||||
|
max_length=64,
|
||||||
|
validators=[
|
||||||
|
django.core.validators.RegexValidator(
|
||||||
|
re.compile("^[-a-zA-Z0-9_]+\\Z"),
|
||||||
|
"Enter a valid “slug” consisting of letters, numbers, underscores or hyphens.",
|
||||||
|
"invalid",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
verbose_name="Icon",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="category",
|
||||||
|
name="name",
|
||||||
|
field=models.CharField(
|
||||||
|
default="Category", max_length=64, verbose_name="Name"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="category",
|
||||||
|
name="user",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="User",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="invoice",
|
||||||
|
name="file",
|
||||||
|
field=models.FileField(
|
||||||
|
max_length=128,
|
||||||
|
upload_to=main.utils.get_path,
|
||||||
|
validators=[django.core.validators.FileExtensionValidator(["pdf"])],
|
||||||
|
verbose_name="File",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="invoice",
|
||||||
|
name="name",
|
||||||
|
field=models.CharField(
|
||||||
|
default="Invoice", max_length=256, verbose_name="Name"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="invoice",
|
||||||
|
name="user",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="User",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="account",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.account",
|
||||||
|
verbose_name="Account",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="date",
|
||||||
|
field=models.DateField(
|
||||||
|
default=datetime.date.today, verbose_name="End date"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="diff",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=0,
|
||||||
|
editable=False,
|
||||||
|
max_digits=12,
|
||||||
|
verbose_name="Difference",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="file",
|
||||||
|
field=models.FileField(
|
||||||
|
blank=True,
|
||||||
|
default="",
|
||||||
|
max_length=256,
|
||||||
|
upload_to=main.utils.get_path,
|
||||||
|
validators=[django.core.validators.FileExtensionValidator(["pdf"])],
|
||||||
|
verbose_name="File",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="start_date",
|
||||||
|
field=models.DateField(
|
||||||
|
default=datetime.date.today, verbose_name="Start date"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="start_value",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2, default=0, max_digits=12, verbose_name="Start value"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="sum",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2,
|
||||||
|
default=0,
|
||||||
|
editable=False,
|
||||||
|
max_digits=12,
|
||||||
|
verbose_name="Transaction difference",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="user",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="User",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="value",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2, default=0, max_digits=12, verbose_name="End value"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="account",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.account",
|
||||||
|
verbose_name="Account",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="category",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
to="main.category",
|
||||||
|
verbose_name="Category",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="name",
|
||||||
|
field=models.CharField(
|
||||||
|
default="Transaction", max_length=256, verbose_name="Name"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="payment",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=128, null=True, verbose_name="Payment"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="real_date",
|
||||||
|
field=models.DateField(blank=True, null=True, verbose_name="Real date"),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="snapshot",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="main.snapshot",
|
||||||
|
verbose_name="Statement",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="trader",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=128, null=True, verbose_name="Trader"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="user",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
editable=False,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
verbose_name="User",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="transaction",
|
||||||
|
name="value",
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2, default=0, max_digits=12, verbose_name="Value"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="account",
|
||||||
|
name="icon",
|
||||||
|
field=models.SlugField(
|
||||||
|
default="building-columns", max_length=64, verbose_name="Icon"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="category",
|
||||||
|
name="icon",
|
||||||
|
field=models.SlugField(
|
||||||
|
default="folder", max_length=64, verbose_name="Icon"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="account",
|
||||||
|
name="default",
|
||||||
|
field=models.BooleanField(default=False, verbose_name="Default"),
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="account",
|
||||||
|
options={
|
||||||
|
"ordering": ["-default", "name"],
|
||||||
|
"verbose_name": "Account",
|
||||||
|
"verbose_name_plural": "Accounts",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="invoice",
|
||||||
|
options={
|
||||||
|
"ordering": ["transaction", "name"],
|
||||||
|
"verbose_name": "Invoice",
|
||||||
|
"verbose_name_plural": "Invoices",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="snapshot",
|
||||||
|
options={
|
||||||
|
"ordering": ["-date", "account"],
|
||||||
|
"verbose_name": "Statement",
|
||||||
|
"verbose_name_plural": "Statements",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name="transaction",
|
||||||
|
options={
|
||||||
|
"ordering": ["-date", "snapshot"],
|
||||||
|
"verbose_name": "Transaction",
|
||||||
|
"verbose_name_plural": "Transactions",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="account",
|
||||||
|
name="icon",
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name="category",
|
||||||
|
name="icon",
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="account",
|
||||||
|
name="icon",
|
||||||
|
field=models.SlugField(default="bank", max_length=24, verbose_name="Icon"),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="category",
|
||||||
|
name="icon",
|
||||||
|
field=models.SlugField(
|
||||||
|
default="folder", max_length=24, verbose_name="Icon"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -3,10 +3,9 @@ import pathlib
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.validators import FileExtensionValidator, validate_slug
|
from django.core.validators import FileExtensionValidator
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.text import format_lazy
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from .utils import get_path
|
from .utils import get_path
|
||||||
|
|
|
@ -9,7 +9,7 @@ from django.contrib.postgres.search import (
|
||||||
)
|
)
|
||||||
from django.core.exceptions import PermissionDenied
|
from django.core.exceptions import PermissionDenied
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
|
|
@ -102,20 +102,7 @@ DATABASES = CONFIG.get(
|
||||||
# Password validation
|
# Password validation
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
|
||||||
|
|
||||||
AUTH_PASSWORD_VALIDATORS = [
|
AUTH_PASSWORD_VALIDATORS = []
|
||||||
{
|
|
||||||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
|
|
Loading…
Reference in a new issue