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.
24 lines
550 B
Python
24 lines
550 B
Python
from django.shortcuts import render
|
|
from rest_framework import viewsets
|
|
|
|
from app.pagination import MyPageNumberPagination
|
|
from event.filters import EventFilter
|
|
from event.models import Event
|
|
from event.serializers import EventSerializer
|
|
|
|
|
|
# Create your views here.
|
|
|
|
class EventViewSet(viewsets.ModelViewSet):
|
|
# 查询集
|
|
queryset = Event.objects.all().order_by('-id')
|
|
# 序列化器
|
|
serializer_class = EventSerializer
|
|
# 分页器
|
|
pagination_class = MyPageNumberPagination
|
|
# 过滤器
|
|
filterset_class = EventFilter
|
|
|
|
|
|
|