1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #4857: Drop support for legacy numeric choice field values

This commit is contained in:
Jeremy Stretch
2020-07-15 16:54:33 -04:00
parent 7461e76606
commit 19d0d6ff10
9 changed files with 4 additions and 337 deletions

View File

@@ -11,6 +11,7 @@ class ExampleChoices(ChoiceSet):
CHOICE_1 = 1
CHOICE_2 = 2
CHOICE_3 = 3
CHOICES = (
('Letters', (
(CHOICE_A, 'A'),
@@ -23,14 +24,6 @@ class ExampleChoices(ChoiceSet):
(CHOICE_3, 'Three'),
)),
)
LEGACY_MAP = {
CHOICE_A: 101,
CHOICE_B: 102,
CHOICE_C: 103,
CHOICE_1: 201,
CHOICE_2: 202,
CHOICE_3: 203,
}
class ChoiceSetTestCase(TestCase):
@@ -42,9 +35,3 @@ class ChoiceSetTestCase(TestCase):
self.assertEqual(ExampleChoices.as_dict(), {
'a': 'A', 'b': 'B', 'c': 'C', 1: 'One', 2: 'Two', 3: 'Three'
})
def test_slug_to_id(self):
self.assertEqual(ExampleChoices.slug_to_id('a'), 101)
def test_id_to_slug(self):
self.assertEqual(ExampleChoices.id_to_slug(101), 'a')