Skip to main content

register_converter

Registers a custom URL converter for use in URL patterns, updating the global converter registry and clearing internal caches for route resolution.

def register_converter(
converter: class,
type_name: string
) - > null

Registers a custom path converter for use in URL patterns and clears relevant internal caches to ensure the new converter is recognized.

Parameters

NameTypeDescription
converterclassThe converter class that implements the required to_python and to_url methods.
type_namestringThe name to be used in path expressions, such as 'uuid' or 'int', which must be unique.

Returns

TypeDescription
nullNothing is returned; the function performs a registration side effect.