设备列表请求bug

This commit is contained in:
caoqianming 2022-01-20 11:01:18 +08:00
parent accfedb1d7
commit ddc54a8c76
1 changed files with 1 additions and 2 deletions

View File

@ -7,7 +7,6 @@ from apps.system.serializers import OrganizationSimpleSerializer, UserSimpleSeri
class EquipmentListSerializer(ModelSerializer): class EquipmentListSerializer(ModelSerializer):
belong_dept_ = OrganizationSimpleSerializer(source='belong_dept', read_only=True)
keeper_ = UserSimpleSerializer(source='keeper', read_only=True) keeper_ = UserSimpleSerializer(source='keeper', read_only=True)
step_ = serializers.SerializerMethodField() step_ = serializers.SerializerMethodField()
class Meta: class Meta:
@ -17,7 +16,7 @@ class EquipmentListSerializer(ModelSerializer):
@staticmethod @staticmethod
def setup_eager_loading(queryset): def setup_eager_loading(queryset):
""" Perform necessary eager loading of data. """ """ Perform necessary eager loading of data. """
queryset = queryset.select_related('belong_dept','keeper') queryset = queryset.select_related('keeper')
return queryset return queryset
def get_step_(self, obj): def get_step_(self, obj):