Fixes #3967: Resolve migration of "other" interface type

This commit is contained in:
Jeremy Stretch 2020-01-21 09:32:51 -05:00
parent 606f3dacbb
commit 9d3215e806
3 changed files with 22 additions and 0 deletions

View File

@ -10,6 +10,7 @@
* [#3721](https://github.com/netbox-community/netbox/issues/3721) - Allow Unicode characters in tag slugs
* [#3951](https://github.com/netbox-community/netbox/issues/3951) - Fix exception in webhook worker due to missing constant
* [#3953](https://github.com/netbox-community/netbox/issues/3953) - Fix validation error when creating child devices
* [#3967](https://github.com/netbox-community/netbox/issues/3967) - Resolve migration of "other" interface type
---

View File

@ -802,6 +802,7 @@ class InterfaceTypeChoices(ChoiceSet):
TYPE_SUMMITSTACK128: 5310,
TYPE_SUMMITSTACK256: 5320,
TYPE_SUMMITSTACK512: 5330,
TYPE_OTHER: 32767,
}

View File

@ -0,0 +1,20 @@
from django.db import migrations
def interface_type_to_slug(apps, schema_editor):
Interface = apps.get_model('dcim', 'Interface')
Interface.objects.filter(type=32767).update(type='other')
class Migration(migrations.Migration):
dependencies = [
('dcim', '0090_cable_termination_models'),
]
operations = [
# Missed type "other" in the initial migration (see #3967)
migrations.RunPython(
code=interface_type_to_slug
),
]