mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fix inclusion of legacy IDs on choice fields
This commit is contained in:
parent
9452cebc6a
commit
f0a6c881bc
@ -86,8 +86,9 @@ class ChoiceField(Field):
|
|||||||
('label', self._choices[obj])
|
('label', self._choices[obj])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# TODO: Remove in v2.8
|
||||||
# Include legacy numeric ID (where applicable)
|
# Include legacy numeric ID (where applicable)
|
||||||
if type(self.choiceset) is ChoiceSet and obj in self.choiceset.LEGACY_MAP:
|
if hasattr(self.choiceset, 'LEGACY_MAP') and obj in self.choiceset.LEGACY_MAP:
|
||||||
data['id'] = self.choiceset.LEGACY_MAP.get(obj)
|
data['id'] = self.choiceset.LEGACY_MAP.get(obj)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
Loading…
Reference in New Issue
Block a user