mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-28 19:36:26 -06:00
Fixes #3878: Fix database migration for cable status field
This commit is contained in:
parent
40169c84e0
commit
434f265345
@ -238,6 +238,7 @@ PATCH) to maintain backward compatibility. This behavior will be discontinued be
|
||||
## Bug Fixes (From Beta)
|
||||
|
||||
* [#3868](https://github.com/digitalocean/netbox/issues/3868) - Fix creation of interfaces for virtual machines
|
||||
* [#3878](https://github.com/digitalocean/netbox/issues/3878) - Fix database migration for cable status field
|
||||
|
||||
## API Changes
|
||||
|
||||
|
@ -24,8 +24,8 @@ CABLE_TYPE_CHOICES = (
|
||||
)
|
||||
|
||||
CABLE_STATUS_CHOICES = (
|
||||
(True, 'connected'),
|
||||
(False, 'planned'),
|
||||
('true', 'connected'),
|
||||
('false', 'planned'),
|
||||
)
|
||||
|
||||
CABLE_LENGTH_UNIT_CHOICES = (
|
||||
@ -44,8 +44,8 @@ def cable_type_to_slug(apps, schema_editor):
|
||||
|
||||
def cable_status_to_slug(apps, schema_editor):
|
||||
Cable = apps.get_model('dcim', 'Cable')
|
||||
for bool, slug in CABLE_STATUS_CHOICES:
|
||||
Cable.objects.filter(status=str(bool)).update(status=slug)
|
||||
for bool_str, slug in CABLE_STATUS_CHOICES:
|
||||
Cable.objects.filter(status=bool_str).update(status=slug)
|
||||
|
||||
|
||||
def cable_length_unit_to_slug(apps, schema_editor):
|
||||
|
@ -2188,6 +2188,8 @@ class CableTestCase(TestCase):
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 4)
|
||||
|
||||
def test_status(self):
|
||||
params = {'status': [CableStatusChoices.STATUS_CONNECTED]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 3)
|
||||
params = {'status': [CableStatusChoices.STATUS_PLANNED]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 3)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user