diff --git a/apps/ofm/migrations/0008_remove_borrowrecord_borrow_user.py b/apps/ofm/migrations/0008_remove_borrowrecord_borrow_user.py new file mode 100644 index 00000000..e8bfb234 --- /dev/null +++ b/apps/ofm/migrations/0008_remove_borrowrecord_borrow_user.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.12 on 2025-09-12 06:42 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('ofm', '0007_auto_20250911_1441'), + ] + + operations = [ + migrations.RemoveField( + model_name='borrowrecord', + name='borrow_user', + ), + ] diff --git a/apps/ofm/serializers.py b/apps/ofm/serializers.py index bca706bf..c02cf4f1 100644 --- a/apps/ofm/serializers.py +++ b/apps/ofm/serializers.py @@ -94,7 +94,7 @@ class FileRecordSerializer(CustomModelSerializer): class BorrowRecordSerializer(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) - files = serializers.PrimaryKeyRelatedField(queryset=FileRecord.objects.all(), many=True, write_only=True, label="借阅文件") + borrow_file = serializers.PrimaryKeyRelatedField(queryset=FileRecord.objects.all(), many=True, write_only=True, label="借阅文件") file_detail = FileRecordSerializer(source='borrow_file', many=True, read_only=True, label="借阅文件详情") class Meta: model = BorrowRecord