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.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-05-06 16:58:44 +03:00
parent 131258517f
commit 0c1caa422c
2 changed files with 38 additions and 0 deletions

View file

@ -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'),
),
]

View file

@ -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'),
),
]