You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from rest_framework import viewsets
|
|
|
|
from product.serializers import *
|
|
|
|
from django_filters.rest_framework import DjangoFilterBackend
|
|
|
|
from product.utils.pagination import PageNumberPagination, CustomPageNumberPagination
|
|
|
|
|
|
|
|
|
|
|
|
# Create your views here.
|
|
|
|
class ProjectViewSet(viewsets.ModelViewSet):
|
|
|
|
# 字段注释
|
|
|
|
"""
|
|
|
|
id: 数据id
|
|
|
|
project_name: 项目名称
|
|
|
|
is_delete: 删除标记
|
|
|
|
"""
|
|
|
|
queryset = Project.objects.all()
|
|
|
|
serializer_class = ProjectSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class PrdItemViewSet(viewsets.ModelViewSet):
|
|
|
|
# 字段注释
|
|
|
|
"""
|
|
|
|
id: 数据id
|
|
|
|
project: 项目名称
|
|
|
|
prd_version: 版本
|
|
|
|
prd_doc_link: 产品文档链接 json格式
|
|
|
|
prd_comment: 产品文档说明
|
|
|
|
is_delete: 删除标记
|
|
|
|
"""
|
|
|
|
queryset = PrdItem.objects.order_by('-id').all()
|
|
|
|
serializer_class = PrdItemSerializer
|
|
|
|
filter_backends = (DjangoFilterBackend,)
|
|
|
|
# http://127.0.0.1:8000/prd/prd_list?project=上影联合院线
|
|
|
|
filterset_fields = ('project',)
|
|
|
|
pagination_class = CustomPageNumberPagination
|