forked from uncloud/uncloud
c456355059
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
38 lines
1,019 B
Python
38 lines
1,019 B
Python
from django.shortcuts import render
|
|
|
|
# Create your views here.
|
|
|
|
from django.contrib.auth.models import User, Group
|
|
from rest_framework import viewsets, permissions
|
|
|
|
from .serializers import UserSerializer, GroupSerializer
|
|
|
|
class CreditCardViewSet(viewsets.ModelViewSet):
|
|
|
|
"""
|
|
API endpoint that allows credit cards to be listed
|
|
"""
|
|
queryset = User.objects.all().order_by('-date_joined')
|
|
serializer_class = UserSerializer
|
|
|
|
permission_classes = [permissions.IsAuthenticated]
|
|
|
|
|
|
class UserViewSet(viewsets.ModelViewSet):
|
|
|
|
"""
|
|
API endpoint that allows users to be viewed or edited.
|
|
"""
|
|
queryset = User.objects.all().order_by('-date_joined')
|
|
serializer_class = UserSerializer
|
|
|
|
permission_classes = [permissions.IsAuthenticated]
|
|
|
|
class GroupViewSet(viewsets.ModelViewSet):
|
|
"""
|
|
API endpoint that allows groups to be viewed or edited.
|
|
"""
|
|
queryset = Group.objects.all()
|
|
serializer_class = GroupSerializer
|
|
|
|
permission_classes = [permissions.IsAuthenticated]
|