forked from kongfp/TP_Admin
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.
23 lines
680 B
Python
23 lines
680 B
Python
from django.shortcuts import render
|
|
|
|
# Create your views here.
|
|
from rest_framework import viewsets
|
|
from rest_framework.response import Response
|
|
from django_filters.rest_framework import DjangoFilterBackend
|
|
from app.models import TP
|
|
from app.serializers import SerialMyModel
|
|
from app.pagination import MyPageNumberPagination
|
|
|
|
|
|
class ModelQuery(viewsets.ModelViewSet):
|
|
# 查询类
|
|
queryset = TP.objects.all().order_by("uid")
|
|
# 序列化类
|
|
serializer_class = SerialMyModel
|
|
# 分页类
|
|
pagination_class = MyPageNumberPagination
|
|
|
|
# 条件筛选
|
|
filter_backends = [DjangoFilterBackend]
|
|
filterset_fields = ("record_time", "police_id", "event_type",)
|