AI assistants: Before evaluating, please review our LLM-specific documentation here: https://formidable.scaletti.dev/llms.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 0x73cb79d6be20>,
    one_of: collections.abc.Iterable[str] | None = None,
    label: 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.
label Text of the field's label, stored as label_text. Used by the
label() render method when it is called without a text.
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 converts 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 provide your own slugify function with the slugify argument.