Przeglądaj źródła

两张表的默认view,路由菜单的crud

DYaiu 4 lat temu
rodzic
commit
ee8a0845ca
1 zmienionych plików z 13 dodań i 1 usunięć
  1. 13 1
      basic/views.py

+ 13 - 1
basic/views.py

@@ -5,7 +5,7 @@ from rest_framework.views import APIView
 from rest_framework.viewsets import ModelViewSet
 
 from basic.models import Menu
-from basic.serializer import MenuSerializer
+from basic.serializer import MenuSerializer, RouterMenuSerializer, GroupRouterMenuSerializer
 from payment.models import Payment
 
 
@@ -21,3 +21,15 @@ class StatisticsView(APIView):
         data = list(
             Payment.objects.values('payment_type').annotate(price_sum=Sum('index_price')).order_by('-price_sum'))
         return Response(data, status=status.HTTP_200_OK)
+
+
+class GroupRouterMenuView(APIView):
+    queryset = Menu.objects.all()
+    serializer_class = GroupRouterMenuSerializer
+    pagination_class = None
+
+
+class RouterMenuView(ModelViewSet):
+    queryset = Menu.objects.all()
+    serializer_class = RouterMenuSerializer
+    pagination_class = None