nautobot.apps.choices
¶
Utilities for implementing choices.
nautobot.apps.choices.BannerClassChoices
¶
Bases:
Styling choices for custom banners.
nautobot.apps.choices.ButtonActionColorChoices
¶
Bases:
Map standard button actions to Bootstrap color classes.
nautobot.apps.choices.ButtonActionIconChoices
¶
Bases:
Map standard button actions to Material Design Icons classes.
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
¶
Bases:
These status choices are using the same taxonomy as within Celery core. A Nautobot Job status is equivalent to a Celery task state.
precedence(state)
staticmethod
¶
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') )