Is there a way to get the status label value of an item in a script #17179
-
Hey everyone, For example, I'd rather return As a note, we do use custom status values in the configuration if that matters. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It looks like each model with the status field has a get_status_display() option, which will return the label for the status it has, e.g:
In addition to get_status_display(), get_status_color() is another option. On a side note, utilizing nbshell can be helpful to determine what options are available for a given model. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
It looks like each model with the status field has a get_status_display() option, which will return the label for the status it has, e.g:
Device.objects.first().get_status_display()
In addition to get_status_display(), get_status_color() is another option.
On a side note, utilizing nbshell can be helpful to determine what options are available for a given model.