Просмотр исходного кода

Convert NullBooleanField to BooleanField(null=True)

Jeremy Stretch 5 лет назад
Родитель
Сommit
68ecddccdb

+ 18 - 0
netbox/circuits/migrations/0019_nullbooleanfield_to_booleanfield.py

@@ -0,0 +1,18 @@
+# Generated by Django 3.1b1 on 2020-07-16 15:55
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('circuits', '0018_standardize_description'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='circuittermination',
+            name='connection_status',
+            field=models.BooleanField(blank=True, null=True),
+        ),
+    ]

+ 3 - 2
netbox/circuits/models.py

@@ -275,9 +275,10 @@ class CircuitTermination(CableTermination):
         blank=True,
         blank=True,
         null=True
         null=True
     )
     )
-    connection_status = models.NullBooleanField(
+    connection_status = models.BooleanField(
         choices=CONNECTION_STATUS_CHOICES,
         choices=CONNECTION_STATUS_CHOICES,
-        blank=True
+        blank=True,
+        null=True
     )
     )
     port_speed = models.PositiveIntegerField(
     port_speed = models.PositiveIntegerField(
         verbose_name='Port speed (Kbps)'
         verbose_name='Port speed (Kbps)'

+ 43 - 0
netbox/dcim/migrations/0113_nullbooleanfield_to_booleanfield.py

@@ -0,0 +1,43 @@
+# Generated by Django 3.1b1 on 2020-07-16 15:55
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('dcim', '0112_standardize_components'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='consoleport',
+            name='connection_status',
+            field=models.BooleanField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='consoleserverport',
+            name='connection_status',
+            field=models.BooleanField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='interface',
+            name='connection_status',
+            field=models.BooleanField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='powerfeed',
+            name='connection_status',
+            field=models.BooleanField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='poweroutlet',
+            name='connection_status',
+            field=models.BooleanField(blank=True, null=True),
+        ),
+        migrations.AlterField(
+            model_name='powerport',
+            name='connection_status',
+            field=models.BooleanField(blank=True, null=True),
+        ),
+    ]

+ 3 - 2
netbox/dcim/models/__init__.py

@@ -1905,9 +1905,10 @@ class PowerFeed(ChangeLoggedModel, CableTermination, CustomFieldModel):
         blank=True,
         blank=True,
         null=True
         null=True
     )
     )
-    connection_status = models.NullBooleanField(
+    connection_status = models.BooleanField(
         choices=CONNECTION_STATUS_CHOICES,
         choices=CONNECTION_STATUS_CHOICES,
-        blank=True
+        blank=True,
+        null=True
     )
     )
     name = models.CharField(
     name = models.CharField(
         max_length=50
         max_length=50

+ 15 - 10
netbox/dcim/models/device_components.py

@@ -264,9 +264,10 @@ class ConsolePort(CableTermination, ComponentModel):
         blank=True,
         blank=True,
         null=True
         null=True
     )
     )
-    connection_status = models.NullBooleanField(
+    connection_status = models.BooleanField(
         choices=CONNECTION_STATUS_CHOICES,
         choices=CONNECTION_STATUS_CHOICES,
-        blank=True
+        blank=True,
+        null=True
     )
     )
     tags = TaggableManager(through=TaggedItem)
     tags = TaggableManager(through=TaggedItem)
 
 
@@ -304,9 +305,10 @@ class ConsoleServerPort(CableTermination, ComponentModel):
         blank=True,
         blank=True,
         help_text='Physical port type'
         help_text='Physical port type'
     )
     )
-    connection_status = models.NullBooleanField(
+    connection_status = models.BooleanField(
         choices=CONNECTION_STATUS_CHOICES,
         choices=CONNECTION_STATUS_CHOICES,
-        blank=True
+        blank=True,
+        null=True
     )
     )
     tags = TaggableManager(through=TaggedItem)
     tags = TaggableManager(through=TaggedItem)
 
 
@@ -370,9 +372,10 @@ class PowerPort(CableTermination, ComponentModel):
         blank=True,
         blank=True,
         null=True
         null=True
     )
     )
-    connection_status = models.NullBooleanField(
+    connection_status = models.BooleanField(
         choices=CONNECTION_STATUS_CHOICES,
         choices=CONNECTION_STATUS_CHOICES,
-        blank=True
+        blank=True,
+        null=True
     )
     )
     tags = TaggableManager(through=TaggedItem)
     tags = TaggableManager(through=TaggedItem)
 
 
@@ -505,9 +508,10 @@ class PowerOutlet(CableTermination, ComponentModel):
         blank=True,
         blank=True,
         help_text="Phase (for three-phase feeds)"
         help_text="Phase (for three-phase feeds)"
     )
     )
-    connection_status = models.NullBooleanField(
+    connection_status = models.BooleanField(
         choices=CONNECTION_STATUS_CHOICES,
         choices=CONNECTION_STATUS_CHOICES,
-        blank=True
+        blank=True,
+        null=True
     )
     )
     tags = TaggableManager(through=TaggedItem)
     tags = TaggableManager(through=TaggedItem)
 
 
@@ -598,9 +602,10 @@ class Interface(CableTermination, ComponentModel, BaseInterface):
         blank=True,
         blank=True,
         null=True
         null=True
     )
     )
-    connection_status = models.NullBooleanField(
+    connection_status = models.BooleanField(
         choices=CONNECTION_STATUS_CHOICES,
         choices=CONNECTION_STATUS_CHOICES,
-        blank=True
+        blank=True,
+        null=True
     )
     )
     lag = models.ForeignKey(
     lag = models.ForeignKey(
         to='self',
         to='self',