From 629c99307211459f7c136c117b7e4d266692c1af Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Wed, 19 Apr 2023 10:03:22 +0200 Subject: [PATCH] Replace icon field with uicon in backend --- nummi/main/forms.py | 4 +- ..._options_alter_invoice_options_and_more.py | 66 +++++++++++++++++++ nummi/main/models.py | 14 ++-- 3 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 nummi/main/migrations/0025_alter_account_options_alter_invoice_options_and_more.py diff --git a/nummi/main/forms.py b/nummi/main/forms.py index d1e5de1..6047bda 100644 --- a/nummi/main/forms.py +++ b/nummi/main/forms.py @@ -21,7 +21,7 @@ class AccountForm(NummiForm): model = Account fields = [ "name", - "icon", + "uicon", "default", ] @@ -31,7 +31,7 @@ class CategoryForm(NummiForm): model = Category fields = [ "name", - "icon", + "uicon", "budget", ] diff --git a/nummi/main/migrations/0025_alter_account_options_alter_invoice_options_and_more.py b/nummi/main/migrations/0025_alter_account_options_alter_invoice_options_and_more.py new file mode 100644 index 0000000..8156b92 --- /dev/null +++ b/nummi/main/migrations/0025_alter_account_options_alter_invoice_options_and_more.py @@ -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" + ), + ), + ] diff --git a/nummi/main/models.py b/nummi/main/models.py index e080242..556acbe 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -43,9 +43,10 @@ def get_path(instance, filename): 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.SlugField( - max_length=64, - default="building-columns", + uicon = models.SlugField( + max_length=1, + default="🏦", + allow_unicode=True, verbose_name=_("Icon"), ) default = models.BooleanField(default=False, verbose_name=_("Default")) @@ -96,9 +97,10 @@ class Category(CustomModel): name = models.CharField( max_length=64, default=_("Category"), verbose_name=_("Name") ) - icon = models.SlugField( - max_length=64, - default="folder", + uicon = models.SlugField( + max_length=1, + default="📂", + allow_unicode=True, verbose_name=_("Icon"), ) budget = models.BooleanField(default=True, verbose_name=_("Budget"))