cma_search/server/apps/supervision/views.py

31 lines
1.1 KiB
Python

from django.shortcuts import render
from rest_framework.mixins import ListModelMixin
from rest_framework.viewsets import GenericViewSet, ModelViewSet
from .models import *
from .serializers import *
from rest_framework.decorators import action
from django.conf import settings
from rest_framework import status
from rest_framework.response import Response
from apps.system.models import Organization
from openpyxl import Workbook, load_workbook
from django.db.models import Count
from utils.pagination import PageOrNot
from apps.system.mixins import CreateModelAMixin
# Create your views here.
class ContentViewSet(CreateModelAMixin, ModelViewSet):
"""
资料清单:增删改查
"""
perms_map = {'get': '*', 'post': 'content_create',
'put': 'content_update', 'delete': 'content_delete'}
queryset = Content.objects.all()
serializer_class = ContentSerializer
search_fields = ['name', 'desc']
filterset_fields = ['type']
ordering = ['type__sort', 'create_time']
def paginate_queryset(self, queryset):
return None