设备列表请求bug
This commit is contained in:
parent
accfedb1d7
commit
ddc54a8c76
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue