You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
558 B
16 lines
558 B
from django.contrib.auth.models import User, Group |
|
from rest_framework import viewsets |
|
from rest_framework import permissions |
|
from myapi.serializers import UserSerializer,GroupSerializer |
|
|
|
|
|
class UserViewSet(viewsets.ModelViewSet): |
|
queryset = User.objects.all().order_by('date_joined') |
|
serializer_class = UserSerializer |
|
permissions_classes = [permissions.IsAuthenticated] |
|
|
|
|
|
class GroupViewSet(viewsets.ModelViewSet): |
|
queryset = Group.objects.all() |
|
serializer_class = GroupSerializer |
|
permissions_classes = [permissions.IsAuthenticated]
|
|
|