mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 09:28:38 -06:00
Explicitly use the value of the choice, instead of relying on __str__
This commit is contained in:
parent
0ab19d723d
commit
0a5eecd0e3
@ -61,7 +61,7 @@ def get_custom_fields_for_model(content_type, filterable_only=False, bulk_edit=F
|
|||||||
|
|
||||||
# Select
|
# Select
|
||||||
elif cf.type == CustomFieldTypeChoices.TYPE_SELECT:
|
elif cf.type == CustomFieldTypeChoices.TYPE_SELECT:
|
||||||
choices = [(cfc.pk, cfc) for cfc in cf.choices.all()]
|
choices = [(cfc.pk, cfc.value) for cfc in cf.choices.all()]
|
||||||
if not cf.required or bulk_edit or filterable_only:
|
if not cf.required or bulk_edit or filterable_only:
|
||||||
choices = [(None, '---------')] + choices
|
choices = [(None, '---------')] + choices
|
||||||
# Check for a default choice
|
# Check for a default choice
|
||||||
|
@ -149,9 +149,6 @@ def example_choices(field, arg=3):
|
|||||||
break
|
break
|
||||||
if not value or not label:
|
if not value or not label:
|
||||||
continue
|
continue
|
||||||
# Handling for custom fields
|
|
||||||
if hasattr(label, 'value'):
|
|
||||||
label = label.value
|
|
||||||
examples.append(label)
|
examples.append(label)
|
||||||
return ', '.join(examples) or 'None'
|
return ', '.join(examples) or 'None'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user