TP_API2.0/TP_PROJECT/app/views.py

22 lines
557 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")
# 序列化类
serializer_class = SerialMyModel
# 分页类
pagination_class = MyPageNumberPagination
# 条件筛选
filterset_class = SerialFilter