From f0a6c881bcaf7d2c65896b6f30c9bcad2d5fe097 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 10 Dec 2019 12:07:54 -0500 Subject: [PATCH] Fix inclusion of legacy IDs on choice fields --- netbox/utilities/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netbox/utilities/api.py b/netbox/utilities/api.py index 36e37667f..0447d9cb0 100644 --- a/netbox/utilities/api.py +++ b/netbox/utilities/api.py @@ -86,8 +86,9 @@ class ChoiceField(Field): ('label', self._choices[obj]) ]) + # TODO: Remove in v2.8 # 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) return data