This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2019-02-21 15:05:59 +00:00
|
|
|
"""passbook admin user API"""
|
|
|
|
from rest_framework.permissions import IsAdminUser
|
|
|
|
from rest_framework.serializers import ModelSerializer
|
|
|
|
from rest_framework.viewsets import ModelViewSet
|
|
|
|
|
|
|
|
from passbook.core.models import User
|
|
|
|
|
|
|
|
|
|
|
|
class UserSerializer(ModelSerializer):
|
|
|
|
"""User Serializer"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = User
|
2019-02-27 14:09:05 +00:00
|
|
|
fields = ['is_superuser', 'username', 'name', 'email', 'date_joined',
|
2019-02-21 15:05:59 +00:00
|
|
|
'uuid']
|
|
|
|
|
|
|
|
|
|
|
|
class UserViewSet(ModelViewSet):
|
|
|
|
"""User Viewset"""
|
|
|
|
|
|
|
|
permission_classes = [IsAdminUser]
|
|
|
|
serializer_class = UserSerializer
|
|
|
|
queryset = User.objects.all()
|