c3lf-system-3/core/authentication/api_v2.py

22 lines
558 B
Python
Raw Normal View History

2023-11-23 22:17:20 +00:00
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