from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import viewsets
from .serializer import UserSerialiser
class UserViewset(viewsets.ReadOnlyModelViewSet):
''' List: 查询用户列表 Retrieve:
查询某用户详情
''' queryset = user.objects.all()
serializer_class = UserSerialiser
filter_backends = (DjangoFilterBackend,)
backends filter_fields = ('username',)