Compare commits
No commits in common. "e438cfd78a33029ec7971f58b00d32234c489c79" and "a1c3563348cb92f799f42ec60e7c7ffd614902b8" have entirely different histories.
e438cfd78a
...
a1c3563348
4 changed files with 24 additions and 155 deletions
|
@ -1,6 +1,12 @@
|
||||||
from django.forms import ModelForm
|
from django.forms import ModelForm
|
||||||
|
|
||||||
from .models import Account, Category, Invoice, Snapshot, Transaction
|
from .models import (
|
||||||
|
Account,
|
||||||
|
Category,
|
||||||
|
Invoice,
|
||||||
|
Snapshot,
|
||||||
|
Transaction,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class NummiForm(ModelForm):
|
class NummiForm(ModelForm):
|
||||||
|
|
|
@ -1,141 +0,0 @@
|
||||||
# Generated by Django 4.1.4 on 2022-12-29 21:15
|
|
||||||
|
|
||||||
import datetime
|
|
||||||
import re
|
|
||||||
|
|
||||||
import django.core.validators
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
("main", "0019_snapshot_sum"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
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é",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -3,7 +3,7 @@ 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.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
@ -34,10 +34,7 @@ class Account(CustomModel):
|
||||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
name = models.CharField(max_length=64, default=_("Account"), verbose_name=_("Name"))
|
name = models.CharField(max_length=64, default=_("Account"), verbose_name=_("Name"))
|
||||||
icon = models.CharField(
|
icon = models.CharField(
|
||||||
max_length=64,
|
max_length=64, default="building-columns", verbose_name=_("Icon")
|
||||||
default="building-columns",
|
|
||||||
verbose_name=_("Icon"),
|
|
||||||
validators=[validate_slug],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -79,12 +76,7 @@ class Category(CustomModel):
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=64, default=_("Category"), verbose_name=_("Name")
|
max_length=64, default=_("Category"), verbose_name=_("Name")
|
||||||
)
|
)
|
||||||
icon = models.CharField(
|
icon = models.CharField(max_length=64, default="folder", verbose_name=_("Icon"))
|
||||||
max_length=64,
|
|
||||||
default="folder",
|
|
||||||
verbose_name=_("Icon"),
|
|
||||||
validators=[validate_slug],
|
|
||||||
)
|
|
||||||
budget = models.BooleanField(default=True, verbose_name=_("Budget"))
|
budget = models.BooleanField(default=True, verbose_name=_("Budget"))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
@ -18,8 +18,20 @@ from django.views.generic import (
|
||||||
)
|
)
|
||||||
from django.views.generic.edit import ProcessFormView
|
from django.views.generic.edit import ProcessFormView
|
||||||
|
|
||||||
from .forms import AccountForm, CategoryForm, InvoiceForm, SnapshotForm, TransactionForm
|
from .models import (
|
||||||
from .models import Account, Category, Invoice, Snapshot, Transaction
|
Account,
|
||||||
|
Category,
|
||||||
|
Invoice,
|
||||||
|
Snapshot,
|
||||||
|
Transaction,
|
||||||
|
)
|
||||||
|
from .forms import (
|
||||||
|
AccountForm,
|
||||||
|
CategoryForm,
|
||||||
|
InvoiceForm,
|
||||||
|
SnapshotForm,
|
||||||
|
TransactionForm,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class IndexView(LoginRequiredMixin, TemplateView):
|
class IndexView(LoginRequiredMixin, TemplateView):
|
||||||
|
|
Loading…
Reference in a new issue