|
|
@@ -8,14 +8,6 @@ RACK_TYPE_CHOICES = (
|
|
|
(1100, 'wall-cabinet'),
|
|
|
)
|
|
|
|
|
|
-RACK_STATUS_CHOICES = (
|
|
|
- (0, 'reserved'),
|
|
|
- (1, 'available'),
|
|
|
- (2, 'planned'),
|
|
|
- (3, 'active'),
|
|
|
- (4, 'deprecated'),
|
|
|
-)
|
|
|
-
|
|
|
|
|
|
def rack_type_to_slug(apps, schema_editor):
|
|
|
Rack = apps.get_model('dcim', 'Rack')
|
|
|
@@ -23,20 +15,14 @@ def rack_type_to_slug(apps, schema_editor):
|
|
|
Rack.objects.filter(type=str(id)).update(type=slug)
|
|
|
|
|
|
|
|
|
-def rack_status_to_slug(apps, schema_editor):
|
|
|
- Rack = apps.get_model('dcim', 'Rack')
|
|
|
- for id, slug in RACK_STATUS_CHOICES:
|
|
|
- Rack.objects.filter(status=str(id)).update(status=slug)
|
|
|
-
|
|
|
-
|
|
|
class Migration(migrations.Migration):
|
|
|
+ atomic = False
|
|
|
|
|
|
dependencies = [
|
|
|
('dcim', '0077_power_types'),
|
|
|
]
|
|
|
|
|
|
operations = [
|
|
|
- # Rack.type
|
|
|
migrations.AlterField(
|
|
|
model_name='rack',
|
|
|
name='type',
|
|
|
@@ -45,13 +31,4 @@ class Migration(migrations.Migration):
|
|
|
migrations.RunPython(
|
|
|
code=rack_type_to_slug
|
|
|
),
|
|
|
- # Rack.status
|
|
|
- migrations.AlterField(
|
|
|
- model_name='rack',
|
|
|
- name='status',
|
|
|
- field=models.CharField(blank=True, default='active', max_length=50),
|
|
|
- ),
|
|
|
- migrations.RunPython(
|
|
|
- code=rack_status_to_slug
|
|
|
- ),
|
|
|
]
|