From a81d03e3ca5d1ab6b40355e9af164dd759acafeb Mon Sep 17 00:00:00 2001 From: TianyangZhang Date: Wed, 19 Nov 2025 10:26:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20ofm-models=20borrowRecord=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=80=9F=E9=98=85=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ofm/migrations/0003_borrowrecord_count.py | 18 ++++++++++++++++++ apps/ofm/models.py | 1 + apps/ofm/serializers.py | 15 --------------- 3 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 apps/ofm/migrations/0003_borrowrecord_count.py diff --git a/apps/ofm/migrations/0003_borrowrecord_count.py b/apps/ofm/migrations/0003_borrowrecord_count.py new file mode 100644 index 00000000..df7133a2 --- /dev/null +++ b/apps/ofm/migrations/0003_borrowrecord_count.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.12 on 2025-11-19 02:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ofm', '0002_remove_vehicleuse_vehiclereg'), + ] + + operations = [ + migrations.AddField( + model_name='borrowrecord', + name='count', + field=models.PositiveIntegerField(blank=True, null=True, verbose_name='借阅份数'), + ), + ] diff --git a/apps/ofm/models.py b/apps/ofm/models.py index e93a04dd..24ea3852 100644 --- a/apps/ofm/models.py +++ b/apps/ofm/models.py @@ -119,6 +119,7 @@ class BorrowRecord(CommonBDModel): borrow_file = models.ManyToManyField(FileRecord, related_name="borrow_records") borrow_date = models.DateField('借阅日期', null=True, blank=True) return_date = models.DateField('归还日期', null=True, blank=True) + count = models.PositiveIntegerField('借阅份数', null=True, blank=True) contacts = models.CharField('借阅人电话', max_length=50, validators=[phone_validator], null=True, blank=True) remark = models.JSONField('用途', default=list, help_text=str(['借阅', '复印', '查阅'])) ticket = models.ForeignKey('wf.ticket', verbose_name='关联工单', diff --git a/apps/ofm/serializers.py b/apps/ofm/serializers.py index 8152d876..5c17c662 100644 --- a/apps/ofm/serializers.py +++ b/apps/ofm/serializers.py @@ -130,21 +130,6 @@ class LendingSealSerializer(CustomModelSerializer): fields = '__all__' read_only_fields = EXCLUDE_FIELDS -# class VehicleRecordSerializer(CustomModelSerializer): -# class meta: -# model = VehicleReg -# fields = '__all__' - -# class VehicleSerializer(CustomModelSerializer): -# create_by_name = serializers.CharField(source='create_by.name', read_only=True) -# belong_dept_name = serializers.CharField(source='belong_dept.name', read_only=True) -# vehiclerd = serializers.PrimaryKeyRelatedField(queryset=VehicleReg.objects.all(), write_only=True, label="车辆记录") -# ticket_ = TicketSimpleSerializer(source='ticket', read_only=True) -# class Meta: -# model = Vehicle -# fields = '__all__' -# read_only_fields = EXCLUDE_FIELDS + ['actual_km'] - class FileRecordSerializer(CustomModelSerializer): create_by_name = serializers.CharField(source='create_by.name', read_only=True) belong_dept_name = serializers.CharField(source='belong_dept.name', read_only=True)