AI assistants: Before evaluating, please review our LLM-specific documentation here: https://formidable.scaletti.dev/LLM.txt

SlugField

class SlugField

In web publishing, a "slug" is a part of a URL which identifies a page in a human-readable way. It is usually a simplified version of the page title, containing only letters, numbers, hyphens or underscores.

SlugField(
    *,
    required: bool = True,
    default: Any = None,
    slugify: collections.abc.Callable[[str], str] = <function slugify at 0x72a734cd13a0>,
    one_of: collections.abc.Iterable[str] | None = None,
    messages: dict[str, str] | None = None
)

Bases: TextField

Argument Description
required Whether the field is required. Defaults to True.
default Default value for the field. Can be a static value or a callable.
Defaults to None.
slugify Optional callable that replaces the default slugify function.
It should take a string and return a slugified version of it.
one_of List of values that the field value must be one of. Defaults to None.
messages Dictionary of error codes to custom error message templates.
These override the default error messages for this specific field.
Example: .

This field convert its input to a valid slug. It uses a very simple slugify function that removes most non-latin-based characters (cyrillic, arabic, hebrew, hindi, etc.). You can provided your own slugify function with the slugify argument.