forked from kongfp/TP_Admin
31
0
Fork 1
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
635 B
Python

2 years ago
from django.shortcuts import render
# Create your views here.
from rest_framework import viewsets
from django_filters.rest_framework import DjangoFilterBackend
from app.models import TP
from app.serializers import SerialMyModel
from app.pagination import MyPageNumberPagination
2 years ago
class ModelQuery(viewsets.ModelViewSet):
# 查询类
queryset = TP.objects.all().order_by("uid")
# 序列化类
2 years ago
serializer_class = SerialMyModel
# 分页类
pagination_class = MyPageNumberPagination
2 years ago
# 条件筛选
2 years ago
filter_backends = [DjangoFilterBackend]
filterset_fields = ("record_time", "police_id", "event_type",)