Django settings that affect django-autoslug:


Allows to define a custom slugifying function.

The function can be repsesented as string or callable, e.g.:

# custom function, path as string:
AUTOSLUG_SLUGIFY_FUNCTION = 'some_app.slugify_func'

# custom function, callable:
AUTOSLUG_SLUGIFY_FUNCTION = some_app.slugify_func

# custom function, defined inline:
AUTOSLUG_SLUGIFY_FUNCTION = lambda slug: 'can i haz %s?' % slug

If no value is given, default value is used.

Default value is one of these depending on availability in given order:

  • unidecode.unidecode() if Unidecode is available;
  • pytils.translit.slugify() if pytils is available;
  • django.template.defaultfilters.slugify() bundled with Django.

django-autoslug also ships a couple of slugify functions that use the translitcodec Python library, e.g.:

# using as many characters as needed to make a natural replacement
AUTOSLUG_SLUGIFY_FUNCTION = 'autoslug.utils.translit_long'

# using the minimum number of characters to make a replacement
AUTOSLUG_SLUGIFY_FUNCTION = 'autoslug.utils.translit_short'

# only performing single character replacements
AUTOSLUG_SLUGIFY_FUNCTION = 'autoslug.utils.translit_one'
Django-autoslug support of modeltranslation is still experimental. If you wish to enable it, please set this option to True in your project settings. Default is False.