diff --git a/apps/wpmw/views.py b/apps/wpmw/views.py index 0b7eb1be..93c927f2 100644 --- a/apps/wpmw/views.py +++ b/apps/wpmw/views.py @@ -1,6 +1,6 @@ from rest_framework.decorators import action from apps.utils.viewsets import CustomModelViewSet, CustomGenericViewSet -from apps.utils.mixins import CustomListModelMixin, RetrieveModelMixin, ComplexQueryMixin +from apps.utils.mixins import CustomListModelMixin, CustomRetrieveModelMixin, ComplexQueryMixin from apps.wpmw.models import Wpr, WprDefect from apps.wpmw.serializers import WprSerializer, WprNewSerializer, WprDetailSerializer, WproutListSerializer, WprChangeNumberSerializer @@ -13,7 +13,7 @@ from apps.utils.sql import query_one_dict from django.db.models.expressions import RawSQL -class WprViewSet(CustomListModelMixin, RetrieveModelMixin, ComplexQueryMixin, CustomGenericViewSet): +class WprViewSet(CustomListModelMixin, CustomRetrieveModelMixin, ComplexQueryMixin, CustomGenericViewSet): """动态产品 动态产品 @@ -35,7 +35,7 @@ class WprViewSet(CustomListModelMixin, RetrieveModelMixin, ComplexQueryMixin, Cu } def add_info_for_list(self, data): - parent_ids = [item["wpr_from"] for item in data if item["wpr_from"]] + parent_ids = [item["wpr_from"] for item in data if item.get("wpr_from", False)] if parent_ids: parent_data = Wpr.objects.filter(id__in=parent_ids).values("id", "number", "data") parent_map = {item["id"]: item for item in parent_data}