Преглед изворни кода

Fix inclusion of legacy IDs on choice fields

Jeremy Stretch пре 6 година
родитељ
комит
f0a6c881bc
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      netbox/utilities/api.py

+ 2 - 1
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