From 0c1caa422cd6986fa020c3c1f3e54ea31709fca0 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Tue, 6 May 2025 16:58:44 +0300 Subject: [PATCH] Add human-readable ID field to Order model Introduced a `human_readable_id` field to the Order model to provide a concise and recognizable identifier, initialized with a default generator. Updated the field to enforce uniqueness to ensure consistent identification across orders. --- .../0017_order_human_readable_id.py | 19 +++++++++++++++++++ .../0018_alter_order_human_readable_id.py | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 core/migrations/0017_order_human_readable_id.py create mode 100644 core/migrations/0018_alter_order_human_readable_id.py diff --git a/core/migrations/0017_order_human_readable_id.py b/core/migrations/0017_order_human_readable_id.py new file mode 100644 index 00000000..e5fc9e8e --- /dev/null +++ b/core/migrations/0017_order_human_readable_id.py @@ -0,0 +1,19 @@ +# Generated by Django 5.1.8 on 2025-05-06 13:58 + +import core.utils +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0016_alter_product_slug'), + ] + + operations = [ + migrations.AddField( + model_name='order', + name='human_readable_id', + field=models.CharField(default=core.utils.generate_human_readable_id, help_text='a human-readable identifier for the order', max_length=6, verbose_name='human readable id'), + ), + ] diff --git a/core/migrations/0018_alter_order_human_readable_id.py b/core/migrations/0018_alter_order_human_readable_id.py new file mode 100644 index 00000000..7f41dd5d --- /dev/null +++ b/core/migrations/0018_alter_order_human_readable_id.py @@ -0,0 +1,19 @@ +# Generated by Django 5.1.8 on 2025-05-06 13:58 + +import core.utils +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0017_order_human_readable_id'), + ] + + operations = [ + migrations.AlterField( + model_name='order', + name='human_readable_id', + field=models.CharField(default=core.utils.generate_human_readable_id, help_text='a human-readable identifier for the order', max_length=6, unique=True, verbose_name='human readable id'), + ), + ]