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

added default values for comments and color fields on tag

John Anderson 7 лет назад
Родитель
Сommit
0a06d92c2e

+ 2 - 2
netbox/extras/migrations/0020_add_color_comments_to_tag.py

@@ -14,11 +14,11 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='tag',
             name='color',
-            field=utilities.fields.ColorField(max_length=6),
+            field=utilities.fields.ColorField(max_length=6, default='9e9e9e'),
         ),
         migrations.AddField(
             model_name='tag',
             name='comments',
-            field=models.TextField(blank=True),
+            field=models.TextField(blank=True, default=''),
         ),
     ]

+ 5 - 2
netbox/extras/models.py

@@ -870,9 +870,12 @@ class ObjectChange(models.Model):
 
 
 class Tag(TagBase):
-    color = ColorField()
+    color = ColorField(
+        default='9e9e9e'
+    )
     comments = models.TextField(
-        blank=True
+        blank=True,
+        default=''
     )