Skip to main content

must_be

Generates a list containing a single validation error message indicating that a specific option value must be of a required type.

def must_be(
type: string,
option: string,
obj: object,
id: string
) - > list

Generates a list containing a single Django system check error indicating that a specific configuration option must be of a certain type.

Parameters

NameTypeDescription
typestringThe expected data type name to be displayed in the error message.
optionstringThe name of the configuration option or setting that failed the type validation.
objobjectThe object instance whose class will be referenced as the source of the error in the system check.
idstringA unique identifier for the system check error, typically following the Django 'app_label.E001' format.

Returns

TypeDescription
listA list containing a single checks.Error object configured with the provided message, object context, and error identifier.