justinmayer / django-autoslug

AutoSlugField for Django. Supports (but not does not require) unidecode/pytils for transliteration. Old issue tracker is at Bitbucket: https://bitbucket.org/neithere/django-autoslug/issues

Home Page:https://readthedocs.org/projects/django-autoslug/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: generating slug from multiple fields

just-developr-m opened this issue · comments

Like:

slug = AutoSlugField(populate_from=['title', 'model'])

Yeah, that would be awesome.

You can anyway do it using a callable like (not tested though):

from django.utils.text import slugify

def populate_from(instance):
     return f"{slugify(instance.title)}-{slugify(instance.model)}"

....
slug = AutoSlugField(populate_from=populate_from)

But anyway, I see, this feature would be great to maintain compatibility with AutoSlufField from django-extensions.