forked from Yaxin/TP_API
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
578 B
Python

from django.shortcuts import render
# Create your views here.
from rest_framework import viewsets
from rest_framework.response import Response
from app.models import TP
from app.serializers import SerialMyModel, SerialFilter
from app.pagination import MyPageNumberPagination
class ModelQuery(viewsets.ModelViewSet):
# 查询类
queryset = TP.objects.all().order_by("-uid") # 按照uid倒序
# 序列化类
serializer_class = SerialMyModel
# 分页类
pagination_class = MyPageNumberPagination
# 条件筛选
filterset_class = SerialFilter