From ce28f6d0b641ea51a9b5e8bcfcb42037de108725 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sat, 31 Dec 2022 09:53:30 +0100 Subject: [PATCH] Update fields icon to slugfield --- ..._alter_account_icon_alter_category_icon.py | 27 +++++++++++++++++++ nummi/main/models.py | 6 ++--- 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 nummi/main/migrations/0022_alter_account_icon_alter_category_icon.py diff --git a/nummi/main/migrations/0022_alter_account_icon_alter_category_icon.py b/nummi/main/migrations/0022_alter_account_icon_alter_category_icon.py new file mode 100644 index 0000000..e81300f --- /dev/null +++ b/nummi/main/migrations/0022_alter_account_icon_alter_category_icon.py @@ -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" + ), + ), + ] diff --git a/nummi/main/models.py b/nummi/main/models.py index ad1021d..e17dfe5 100644 --- a/nummi/main/models.py +++ b/nummi/main/models.py @@ -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"))