mirror of
https://github.com/lemeow125/Ivy-Backend.git
synced 2025-06-29 00:55:42 +08:00
Polished code
This commit is contained in:
parent
fa684fb195
commit
4f9d2eab6d
5 changed files with 15 additions and 21 deletions
|
@ -1,13 +1,9 @@
|
|||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
from rest_framework import routers
|
||||
from . import views
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'user_list', views.UserListViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('djoser.urls')),
|
||||
path('', include('djoser.urls.authtoken')),
|
||||
path('', include(router.urls)),
|
||||
path('user_list/', views.UserListViewSet.as_view())
|
||||
]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from rest_framework import viewsets
|
||||
from rest_framework import viewsets, generics
|
||||
from .serializers import UserSerializer
|
||||
from django.contrib.auth.models import User
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
|
@ -6,8 +6,7 @@ from rest_framework.permissions import IsAuthenticated
|
|||
# Create your views here.
|
||||
|
||||
|
||||
class UserListViewSet(viewsets.ModelViewSet):
|
||||
permission_classes = [IsAuthenticated]
|
||||
http_method_names = ['get']
|
||||
class UserListViewSet(generics.ListAPIView):
|
||||
# permission_classes = [IsAuthenticated]
|
||||
serializer_class = UserSerializer
|
||||
queryset = User.objects.all()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue