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.
50 lines
1.5 KiB
50 lines
1.5 KiB
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.filter(is_delete=False).all() |
|
serializer_class = ProjectSerializer |
|
|
|
|
|
class PrdItemViewSet(viewsets.ModelViewSet): |
|
# 字段注释 |
|
""" |
|
id: 数据id |
|
project: 项目名称 |
|
prd_version: 版本 |
|
prd_doc_link: 产品文档链接 json格式 |
|
prd_comment: 产品文档说明 |
|
is_delete: 删除标记 |
|
""" |
|
queryset = PrdItem.objects.filter(is_delete=False).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 |
|
|
|
|
|
class PrdHistoryViewSet(viewsets.ModelViewSet): |
|
# 字段注释 |
|
""" |
|
id: 数据id |
|
prd_id: 版本id |
|
history_doc_link: 历史产品原型链接 |
|
update_at: 最后更新日期 |
|
is_delete: 删除标记 |
|
""" |
|
queryset = PrdHistory.objects.filter(is_delete=False).order_by('-update_at').all() |
|
serializer_class = PrdHistorySerializer |
|
filter_backends = (DjangoFilterBackend,) |
|
# http://127.0.0.1:8000/prd/prd_history?prd_id=1 |
|
filterset_fields = ('prd_id',) |