Features: 1) Update slug field in Category model to populate from both uuid and name.
Fixes: 1) None. Extra: 1) Add Django migration to reflect `slug` field changes in the database.
This commit is contained in:
parent
e99ae9e85c
commit
b6ab56624b
2 changed files with 30 additions and 1 deletions
26
core/migrations/0030_alter_category_slug.py
Normal file
26
core/migrations/0030_alter_category_slug.py
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Generated by Django 5.2 on 2025-06-21 16:34
|
||||||
|
|
||||||
|
import django_extensions.db.fields
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("core", "0029_alter_category_slug"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="category",
|
||||||
|
name="slug",
|
||||||
|
field=django_extensions.db.fields.AutoSlugField(
|
||||||
|
allow_unicode=True,
|
||||||
|
blank=True,
|
||||||
|
editable=False,
|
||||||
|
null=True,
|
||||||
|
populate_from=("uuid", "name"),
|
||||||
|
unique=True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -214,7 +214,10 @@ class Category(ExportModelOperationsMixin("category"), NiceModel, MPTTModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
slug: str = AutoSlugField( # type: ignore
|
slug: str = AutoSlugField( # type: ignore
|
||||||
populate_from=("name",),
|
populate_from=(
|
||||||
|
"uuid",
|
||||||
|
"name",
|
||||||
|
),
|
||||||
allow_unicode=True,
|
allow_unicode=True,
|
||||||
unique=True,
|
unique=True,
|
||||||
editable=False,
|
editable=False,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue