|
@@ -6,6 +6,11 @@ POWERFEED_TYPE_CHOICES = (
|
|
|
(2, 'redundant'),
|
|
(2, 'redundant'),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+POWERFEED_SUPPLY_CHOICES = (
|
|
|
|
|
+ (1, 'ac'),
|
|
|
|
|
+ (2, 'dc'),
|
|
|
|
|
+)
|
|
|
|
|
+
|
|
|
|
|
|
|
|
def powerfeed_type_to_slug(apps, schema_editor):
|
|
def powerfeed_type_to_slug(apps, schema_editor):
|
|
|
PowerFeed = apps.get_model('dcim', 'PowerFeed')
|
|
PowerFeed = apps.get_model('dcim', 'PowerFeed')
|
|
@@ -13,6 +18,12 @@ def powerfeed_type_to_slug(apps, schema_editor):
|
|
|
PowerFeed.objects.filter(type=id).update(type=slug)
|
|
PowerFeed.objects.filter(type=id).update(type=slug)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def powerfeed_supply_to_slug(apps, schema_editor):
|
|
|
|
|
+ PowerFeed = apps.get_model('dcim', 'PowerFeed')
|
|
|
|
|
+ for id, slug in POWERFEED_SUPPLY_CHOICES:
|
|
|
|
|
+ PowerFeed.objects.filter(supply=id).update(supply=slug)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
class Migration(migrations.Migration):
|
|
class Migration(migrations.Migration):
|
|
|
atomic = False
|
|
atomic = False
|
|
|
|
|
|
|
@@ -22,7 +33,7 @@ class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
operations = [
|
|
operations = [
|
|
|
|
|
|
|
|
- # Cable.type
|
|
|
|
|
|
|
+ # PowerFeed.type
|
|
|
migrations.AlterField(
|
|
migrations.AlterField(
|
|
|
model_name='powerfeed',
|
|
model_name='powerfeed',
|
|
|
name='type',
|
|
name='type',
|
|
@@ -32,4 +43,14 @@ class Migration(migrations.Migration):
|
|
|
code=powerfeed_type_to_slug
|
|
code=powerfeed_type_to_slug
|
|
|
),
|
|
),
|
|
|
|
|
|
|
|
|
|
+ # PowerFeed.supply
|
|
|
|
|
+ migrations.AlterField(
|
|
|
|
|
+ model_name='powerfeed',
|
|
|
|
|
+ name='supply',
|
|
|
|
|
+ field=models.CharField(blank=True, max_length=50),
|
|
|
|
|
+ ),
|
|
|
|
|
+ migrations.RunPython(
|
|
|
|
|
+ code=powerfeed_supply_to_slug
|
|
|
|
|
+ ),
|
|
|
|
|
+
|
|
|
]
|
|
]
|