django-slugify-processor

Custom slug processors for Django’s slugify(). With no SLUGIFY_PROCESSORS setting, django-slugify-processor keeps Django’s default slug behavior, so you can add processors only when a term needs special handling.

Quickstart

Install, learn the pipeline, and start slugifying.

Quickstart
API Reference

Every public function and template filter.

API Reference
Contributing

Development setup, code style, release process.

Project

Install

$ python -m pip install django-slugify-processor
$ uv add django-slugify-processor

At a glance

Define a processor function that rewrites the text before Django finishes the slug:

>>> def my_processor(value: str) -> str:
...     return value.replace("C++", "Cpp")
>>> my_processor("C++")
'Cpp'

Register the processor’s import string in your Django settings:

SLUGIFY_PROCESSORS = [
    "myapp.processors.my_processor",
]

Use the drop-in slugify() replacement:

>>> from django.test import override_settings
>>> from django_slugify_processor.text import slugify
>>> with override_settings(
...     SLUGIFY_PROCESSORS=["test_app.coding.slugify_programming_languages"],
... ):
...     slugify("C++")
'cpp'