Compare commits

...

2 commits

Author SHA1 Message Date
34d5ce647c
Order form fields - closes #2 2022-12-31 09:57:34 +01:00
ce28f6d0b6
Update fields icon to slugfield 2022-12-31 09:53:30 +01:00
3 changed files with 49 additions and 8 deletions

View file

@ -24,13 +24,26 @@ class AccountForm(NummiForm):
class CategoryForm(NummiForm):
class Meta:
model = Category
fields = "__all__"
fields = [
"name",
"icon",
]
class TransactionForm(NummiForm):
class Meta:
model = Transaction
fields = "__all__"
fields = [
"snapshot",
"name",
"value",
"date",
"real_date",
"category",
"trader",
"payment",
"description",
]
def __init__(self, *args, **kwargs):
_user = kwargs.get("user")
@ -44,13 +57,16 @@ class InvoiceForm(NummiForm):
class Meta:
model = Invoice
fields = "__all__"
fields = [
"name",
"file",
]
class SnapshotForm(NummiForm):
class Meta:
model = Snapshot
fields = "__all__"
fields = ["account", "start_date", "date", "start_value", "value", "file"]
def __init__(self, *args, **kwargs):
_user = kwargs.get("user")

View file

@ -0,0 +1,27 @@
# Generated by Django 4.1.4 on 2022-12-31 08:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("main", "0021_alter_account_options_alter_category_options_and_more"),
]
operations = [
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"
),
),
]

View file

@ -33,11 +33,10 @@ class CustomModel(UserModel):
class Account(CustomModel):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=64, default=_("Account"), verbose_name=_("Name"))
icon = models.CharField(
icon = models.SlugField(
max_length=64,
default="building-columns",
verbose_name=_("Icon"),
validators=[validate_slug],
)
def __str__(self):
@ -79,11 +78,10 @@ class Category(CustomModel):
name = models.CharField(
max_length=64, default=_("Category"), verbose_name=_("Name")
)
icon = models.CharField(
icon = models.SlugField(
max_length=64,
default="folder",
verbose_name=_("Icon"),
validators=[validate_slug],
)
budget = models.BooleanField(default=True, verbose_name=_("Budget"))