nautobot.apps.choices
¶
Utilities for implementing choices.
nautobot.apps.choices.ButtonActionColorChoices
¶
nautobot.apps.choices.ButtonActionIconChoices
¶
nautobot.apps.choices.ChoiceSet
¶
Base class for defining choices for a model and/or menu.
Subclasses should define a CHOICES constant which consists of a list of tuples of the form (value, display_str)
,
or optionally as tuples of the form (grouping, ((value, display_str), (value, display_str), ...))
.
Example
nautobot.apps.choices.JobResultStatusChoices
¶
nautobot.apps.choices.unpack_grouped_choices(choices)
¶
Unpack a grouped choices hierarchy into a flat list of two-tuples. For example:
choices = ( ('Foo', ( (1, 'A'), (2, 'B') )), ('Bar', ( (3, 'C'), (4, 'D') )) )
becomes:
choices = ( (1, 'A'), (2, 'B'), (3, 'C'), (4, 'D') )