Django modeltranslation and AutoSlugField
I'm struggling with combination of AutoSlugField (from django-extensions) and ModelTranslation.
class Article(models.Model):
title = models.CharField(max_length=255, default="")
slug = AutoSlugField(
populate_from=[
"title",
],
overwrite=True,
)
Make perfect sense without model translation. Unfortunately, if title and slug fields are translatable it does not work out of the box.
The migration file created by ModelTranslation contains description for AutoSlugField:
migrations.AlterField(
model_name="article",
name="slug_de",
field=django_extensions.db.fields.AutoSlugField(
blank=True, editable=False, null=True, populate_from=["title"]
),
),
migrations.AlterField(
model_name="article",
name="slug_en",
field=django_extensions.db.fields.AutoSlugField(
blank=True, editable=False, null=True, populate_from=["title"]
),
),
But slug_en should be based on title_en and slug_de should be based on title_de. Is it possible to enforce such behavior?