mirror of https://github.com/jumpserver/jumpserver
parent
9a6d20b6ec
commit
6458231946
@ -1,3 +1,12 @@
|
||||
# ~*~ coding: utf-8 ~*~
|
||||
#
|
||||
#
|
||||
|
||||
from rest_framework import viewsets
|
||||
|
||||
from .serializers import UserSerializer
|
||||
from .models import User, UserGroup, Role
|
||||
|
||||
|
||||
class UserViewSet(viewsets.ModelViewSet):
|
||||
queryset = User.objects.all()
|
||||
serializer_class = UserSerializer
|
||||
|
@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
from django.conf.urls import url, include
|
||||
from rest_framework import routers
|
||||
|
||||
from .api import UserViewSet
|
||||
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'users', UserViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'v1/', include(router.urls)),
|
||||
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
|
||||
]
|
||||
|
@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from .models import Role, User, UserGroup
|
||||
|
||||
|
||||
class UserSerializer(serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = User
|
||||
fields = '__all__'
|
Loading…
Reference in new issue