c3lf-system-3/core/authentication/api_v2.py
2024-01-07 17:50:12 +01:00

21 lines
558 B
Python

from rest_framework import routers, viewsets, serializers
from django.contrib.auth.models import User
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'email', 'first_name', 'last_name')
class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all()
serializer_class = UserSerializer
authentication_classes = []
permission_classes = []
router = routers.SimpleRouter()
router.register(r'users', UserViewSet, basename='users')
urlpatterns = router.urls