Created
July 15, 2014 18:00
-
-
Save macndesign/5bd47a4650b91306dc8a to your computer and use it in GitHub Desktop.
drf test view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.models import User, Group | |
from rest_framework import viewsets | |
from core.serializers import UserSerializer, GroupSerializer | |
from django.views.generic.base import TemplateView | |
class UserViewSet(viewsets.ModelViewSet): | |
""" | |
API endpoint that allows users to be viewed or edited. | |
""" | |
queryset = User.objects.all() | |
serializer_class = UserSerializer | |
class GroupViewSet(viewsets.ModelViewSet): | |
""" | |
API endpoint that allows groups to be viewed or edited. | |
""" | |
queryset = Group.objects.all() | |
serializer_class = GroupSerializer | |
class Home(TemplateView): | |
template_name = 'base.html' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment