URLS¶
A metaclass and converter for Django’s URL dispatcher to use with Python’s Enum class.
- django_enum.urls.register_enum_converter(enum: Type[Enum], type_name='', prop='value')[source]¶
Register an enum converter for Django’s URL dispatcher.
- Parameters:
enum – The enumeration type to register.
type_name –
the name to use for the converter, defaults to the enum class name:
path("<type_name:kwarg_name>", view, view_name)
prop – The property name to use in the urls - by default the value is used.