feat: equipment增加power_kw字段

This commit is contained in:
caoqianming 2023-06-30 17:14:18 +08:00
parent f62344509f
commit 673fd0501c
3 changed files with 21 additions and 2 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.12 on 2023-06-30 09:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('em', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='equipment',
name='power_kw',
field=models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='功率'),
),
]

View File

@ -63,6 +63,7 @@ class Equipment(CommonBModel):
cycle = models.PositiveSmallIntegerField('校准或检定周期(月)', null=True, blank=True) cycle = models.PositiveSmallIntegerField('校准或检定周期(月)', null=True, blank=True)
check_date = models.DateField('最近校准检查日期', blank=True, null=True) check_date = models.DateField('最近校准检查日期', blank=True, null=True)
next_check_date = models.DateField('预计下次校准检查日期',blank=True, null=True) next_check_date = models.DateField('预计下次校准检查日期',blank=True, null=True)
power_kw = models.PositiveSmallIntegerField('功率', null=True, blank=True)
class Meta: class Meta:
verbose_name = '设备信息' verbose_name = '设备信息'

View File

@ -6,8 +6,8 @@ from rest_framework import serializers
class EquipmentSerializer(CustomModelSerializer): class EquipmentSerializer(CustomModelSerializer):
belong_dept = serializers.PrimaryKeyRelatedField(label='责任部门', queryset = Dept.objects.all()) belong_dept = serializers.PrimaryKeyRelatedField(label='责任部门', queryset = Dept.objects.all())
keeper_name = serializers.CharField(source='keeper.name') keeper_name = serializers.CharField(source='keeper.name', read_only=True)
belong_dept_name = serializers.CharField(source='belong_dept.name') belong_dept_name = serializers.CharField(source='belong_dept.name', read_only=True)
class Meta: class Meta:
model = Equipment model = Equipment
fields = '__all__' fields = '__all__'