Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

get_queryset django rest framework

from django.contrib.auth.models import User
from myapp.serializers import UserSerializer
from rest_framework import generics
from rest_framework.permissions import IsAdminUser

class UserList(generics.ListCreateAPIView):
    queryset = User.objects.all()
    serializer_class = UserSerializer
    permission_classes = [IsAdminUser]
Source by www.django-rest-framework.org #
 
PREVIOUS NEXT
Tagged: #django #rest #framework
ADD COMMENT
Topic
Name
9+7 =