cleanup urls
This commit is contained in:
parent
a58a361254
commit
aa59b05a2d
3 changed files with 3 additions and 17 deletions
|
@ -18,14 +18,12 @@ from django.urls import path, include
|
||||||
|
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
|
|
||||||
from uncloud_api import views as apiviews
|
|
||||||
from uncloud_vm import views as vmviews
|
from uncloud_vm import views as vmviews
|
||||||
from opennebula import views as oneviews
|
from opennebula import views as oneviews
|
||||||
|
|
||||||
router = routers.DefaultRouter()
|
router = routers.DefaultRouter()
|
||||||
|
|
||||||
router.register(r'user', apiviews.UserViewSet, basename='user')
|
# user / regular urls
|
||||||
|
|
||||||
router.register(r'vm/snapshot', apiviews.VMSnapshotView, basename='VMSnapshot')
|
router.register(r'vm/snapshot', apiviews.VMSnapshotView, basename='VMSnapshot')
|
||||||
router.register(r'vm/vm', vmviews.VMProductViewSet, basename='vmproduct')
|
router.register(r'vm/vm', vmviews.VMProductViewSet, basename='vmproduct')
|
||||||
|
|
||||||
|
@ -35,10 +33,7 @@ router.register(r'admin/opennebula', oneviews.VMViewSet, basename='opennebula')
|
||||||
router.register(r'admin/opennebula_raw', oneviews.RawVMViewSet)
|
router.register(r'admin/opennebula_raw', oneviews.RawVMViewSet)
|
||||||
|
|
||||||
|
|
||||||
# Wire up our API using automatic URL routing.
|
|
||||||
# Additionally, we include login URLs for the browsable API.
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', include(router.urls)),
|
path('', include(router.urls)),
|
||||||
path('admin/', admin.site.urls), # login to django itself
|
|
||||||
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) # for login to REST API
|
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) # for login to REST API
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from django.contrib.auth.models import Group
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
@ -7,8 +6,3 @@ class UserSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = get_user_model()
|
model = get_user_model()
|
||||||
fields = ['url', 'username', 'email']
|
fields = ['url', 'username', 'email']
|
||||||
|
|
||||||
class GroupSerializer(serializers.HyperlinkedModelSerializer):
|
|
||||||
class Meta:
|
|
||||||
model = Group
|
|
||||||
fields = ['url', 'name']
|
|
||||||
|
|
|
@ -7,10 +7,7 @@ from rest_framework import viewsets, permissions, generics
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
|
||||||
from uncloud_vm.models import VMProduct
|
from .serializers import UserSerializer
|
||||||
from .models import VMSnapshotProduct
|
|
||||||
from .serializers import UserSerializer, GroupSerializer, VMSnapshotSerializer, VMSnapshotCreateSerializer
|
|
||||||
|
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Reference in a new issue