fix: jsonfield 默认blank=True

This commit is contained in:
caoqianming 2024-02-28 16:18:50 +08:00
parent 2e15c8ff31
commit 983e11af74
2 changed files with 25 additions and 2 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.12 on 2024-02-28 08:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('em', '0013_auto_20240226_1018'),
]
operations = [
migrations.AlterField(
model_name='equipment',
name='coordinates',
field=models.JSONField(blank=True, default=dict, verbose_name='坐标'),
),
migrations.AlterField(
model_name='equipment',
name='tags',
field=models.JSONField(blank=True, default=list, verbose_name='设备标签'),
),
]

View File

@ -81,7 +81,7 @@ class Equipment(CommonBModel):
'类型', choices=etype_choices, default=10)
cate = models.ForeignKey(
Ecate, verbose_name='设备分类', on_delete=models.SET_NULL, null=True, blank=True, related_name='cate')
tags = models.JSONField('设备标签', default=list, null=True)
tags = models.JSONField('设备标签', default=list, blank=True)
name = models.CharField('设备名称', max_length=50)
number_factory = models.CharField(
'出厂编号', max_length=50, default='', blank=True)
@ -120,7 +120,7 @@ class Equipment(CommonBModel):
next_check_date = models.DateField('预计下次校准检查日期', blank=True, null=True)
power_kw = models.PositiveSmallIntegerField('功率', null=True, blank=True)
coordinates = models.JSONField('坐标', default=dict, null=True)
coordinates = models.JSONField('坐标', default=dict, blank=True)
class Meta:
verbose_name = '设备信息'