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

URLField

class URLField

A field for validating URLs.

URLField(
    *,
    required: bool = True,
    default: Any = None,
    schemes: collections.abc.Iterable[str] | None = None,
    one_of: collections.abc.Iterable[str] | None = None,
    label: str | None = None,
    messages: dict[str, str] | None = None
)

Bases: Field

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.
schemes URL/URI scheme list to validate against. If not provided,
the default list is ["http", "https"].
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: .

Even if the format is valid, it cannot guarantee that the URL is real. The purpose of this function is to alert the user of a typing mistake.

Perform an UTS-46 normalization of the domain, which includes lowercasing (domain names are case-insensitive), NFC normalization, and converting all label separators (the period/full stop, fullwidth full stop, ideographic full stop, and halfwidth ideographic full stop) to basic periods.