From ebccaa2a50065ae2a7abd22377a6adf01f0af758 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 10 May 2024 09:13:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20customlist=E6=9B=BF=E4=BB=A3listmixin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/views.py | 11 +++++------ apps/enp/views.py | 12 ++++++------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/apps/enm/views.py b/apps/enm/views.py index 82bae905..4c2660b4 100644 --- a/apps/enm/views.py +++ b/apps/enm/views.py @@ -2,8 +2,7 @@ from django.shortcuts import render from django.conf import settings from apps.enm.models import Mpoint, MpointStat, EnStat, EnStat2, MpLogx from apps.utils.viewsets import CustomModelViewSet, CustomGenericViewSet -from rest_framework.mixins import ListModelMixin -from apps.utils.mixins import BulkCreateModelMixin, BulkDestroyModelMixin +from apps.utils.mixins import BulkCreateModelMixin, BulkDestroyModelMixin, CustomListModelMixin from apps.enm.serializers import MpointSerializer, MpLogxSerializer, MpointStatSerializer, EnStatSerializer, EnStat2Serializer, ReCalSerializer from apps.enm.filters import MpointStatFilter, EnStatFilter, EnStat2Filter from apps.enm.tasks import cal_mpointstat_manual @@ -64,7 +63,7 @@ class MpointViewSet(CustomModelViewSet): # filterset_fields = ['mpoint', 'mpoint__mgroup', 'mpoint__mgroup__belong_dept'] -class MpLogxViewSet(ListModelMixin, CustomGenericViewSet): +class MpLogxViewSet(CustomListModelMixin, CustomGenericViewSet): """ list: 测点采集数据 @@ -82,7 +81,7 @@ class MpLogxViewSet(ListModelMixin, CustomGenericViewSet): ordering = ["-timex"] -class MpointStatViewSet(BulkCreateModelMixin, BulkDestroyModelMixin, ListModelMixin, CustomGenericViewSet): +class MpointStatViewSet(BulkCreateModelMixin, BulkDestroyModelMixin, CustomListModelMixin, CustomGenericViewSet): """ list:测点统计记录 @@ -118,7 +117,7 @@ class MpointStatViewSet(BulkCreateModelMixin, BulkDestroyModelMixin, ListModelMi return Response({"task_id": task.task_id}) -class EnStatViewSet(ListModelMixin, CustomGenericViewSet): +class EnStatViewSet(CustomListModelMixin, CustomGenericViewSet): """ list:能耗统计记录 @@ -133,7 +132,7 @@ class EnStatViewSet(ListModelMixin, CustomGenericViewSet): ordering = ["mgroup__sort", "year_s", "month_s", "day_s", "hour"] -class EnStat2ViewSet(ListModelMixin, CustomGenericViewSet): +class EnStat2ViewSet(CustomListModelMixin, CustomGenericViewSet): """ list:全厂统计记录 diff --git a/apps/enp/views.py b/apps/enp/views.py index dd0bd408..23f4f62f 100644 --- a/apps/enp/views.py +++ b/apps/enp/views.py @@ -1,6 +1,6 @@ from django.shortcuts import render -from apps.utils.viewsets import CustomModelViewSet, CustomGenericViewSet, ListModelMixin -from apps.utils.mixins import BulkCreateModelMixin, BulkDestroyModelMixin +from apps.utils.viewsets import CustomModelViewSet, CustomGenericViewSet +from apps.utils.mixins import BulkCreateModelMixin, BulkDestroyModelMixin, CustomListModelMixin from .serializers import DrainSerializer, DrainEquipSerializer, DrainEquipEnvSerializer, VehicleAccessSerializer, EnvDataSerializer, EnvDataExportSerializer, CarWashSerializer, Drain2Serializer from .models import Drain, DrainEquip, VehicleAccess, EnvData, CarWash from rest_framework.decorators import action @@ -57,7 +57,7 @@ class DrainViewSet(CustomModelViewSet): return Response(json_result) -class DrainEquipViewSet(ListModelMixin, BulkCreateModelMixin, BulkDestroyModelMixin, CustomGenericViewSet): +class DrainEquipViewSet(CustomListModelMixin, BulkCreateModelMixin, BulkDestroyModelMixin, CustomGenericViewSet): """ list: 排口/设备关系 @@ -85,7 +85,7 @@ class DrainEquipViewSet(ListModelMixin, BulkCreateModelMixin, BulkDestroyModelMi return super().list(request, *args, **kwargs) -class VehicleAccessViewSet(ListModelMixin, CustomGenericViewSet): +class VehicleAccessViewSet(CustomListModelMixin, CustomGenericViewSet): """ list: 车辆出入记录 @@ -104,7 +104,7 @@ class VehicleAccessViewSet(ListModelMixin, CustomGenericViewSet): } -class EnvDataViewSet(ListModelMixin, CustomGenericViewSet): +class EnvDataViewSet(CustomListModelMixin, CustomGenericViewSet): """ list: 环保时序数据 @@ -130,7 +130,7 @@ class EnvDataViewSet(ListModelMixin, CustomGenericViewSet): return Response() -class CarWashViewSet(ListModelMixin, CustomGenericViewSet): +class CarWashViewSet(CustomListModelMixin, CustomGenericViewSet): """ list: 洗车记录