Replace icon field with uicon in backend

This commit is contained in:
Edgar P. Burkhart 2023-04-19 10:03:22 +02:00
parent 71269377b4
commit 629c993072
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 76 additions and 8 deletions

View file

@ -21,7 +21,7 @@ class AccountForm(NummiForm):
model = Account model = Account
fields = [ fields = [
"name", "name",
"icon", "uicon",
"default", "default",
] ]
@ -31,7 +31,7 @@ class CategoryForm(NummiForm):
model = Category model = Category
fields = [ fields = [
"name", "name",
"icon", "uicon",
"budget", "budget",
] ]

View file

@ -0,0 +1,66 @@
# Generated by Django 4.1.4 on 2023-04-19 08:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("main", "0024_account_default"),
]
operations = [
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="uicon",
field=models.SlugField(
allow_unicode=True, default="🏦", max_length=1, verbose_name="Icon"
),
),
migrations.AddField(
model_name="category",
name="uicon",
field=models.SlugField(
allow_unicode=True, default="📂", max_length=1, verbose_name="Icon"
),
),
]

View file

@ -43,9 +43,10 @@ def get_path(instance, filename):
class Account(CustomModel): 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.SlugField( uicon = models.SlugField(
max_length=64, max_length=1,
default="building-columns", default="🏦",
allow_unicode=True,
verbose_name=_("Icon"), verbose_name=_("Icon"),
) )
default = models.BooleanField(default=False, verbose_name=_("Default")) default = models.BooleanField(default=False, verbose_name=_("Default"))
@ -96,9 +97,10 @@ 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.SlugField( uicon = models.SlugField(
max_length=64, max_length=1,
default="folder", default="📂",
allow_unicode=True,
verbose_name=_("Icon"), verbose_name=_("Icon"),
) )
budget = models.BooleanField(default=True, verbose_name=_("Budget")) budget = models.BooleanField(default=True, verbose_name=_("Budget"))