feat(core): replace AutoSlugField with TweakedAutoSlugField for product slugs
Updated `product.slug` to use `TweakedAutoSlugField` for improved functionality, allowing unicode, overwrite capabilities, and enhanced population logic. Adjusted the corresponding migration script to ensure seamless database schema updates. Also marked `brand.categories` as deprecated.
This commit is contained in:
parent
ec167d4e9c
commit
8883b9f43d
2 changed files with 40 additions and 1 deletions
|
|
@ -0,0 +1,39 @@
|
||||||
|
# Generated by Django 5.2.11 on 2026-02-21 19:12
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import engine.core.utils.db
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("core", "0054_product_export_to_marketplaces"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="brand",
|
||||||
|
name="categories",
|
||||||
|
field=models.ManyToManyField(
|
||||||
|
blank=True,
|
||||||
|
help_text="DEPRECATED",
|
||||||
|
to="core.category",
|
||||||
|
verbose_name="DEPRECATED",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="product",
|
||||||
|
name="slug",
|
||||||
|
field=engine.core.utils.db.TweakedAutoSlugField(
|
||||||
|
allow_unicode=True,
|
||||||
|
blank=True,
|
||||||
|
editable=False,
|
||||||
|
max_length=88,
|
||||||
|
null=True,
|
||||||
|
overwrite=True,
|
||||||
|
populate_from=("name", "brand__slug", "category__slug", "uuid"),
|
||||||
|
unique=True,
|
||||||
|
verbose_name="Slug",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -664,7 +664,7 @@ class Product(ExportModelOperationsMixin("product"), NiceModel):
|
||||||
help_text=_("part number for this product"),
|
help_text=_("part number for this product"),
|
||||||
verbose_name=_("part number"),
|
verbose_name=_("part number"),
|
||||||
)
|
)
|
||||||
slug = AutoSlugField(
|
slug = TweakedAutoSlugField(
|
||||||
populate_from=(
|
populate_from=(
|
||||||
"name",
|
"name",
|
||||||
"brand__slug",
|
"brand__slug",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue