cleanup urls

This commit is contained in:
Nico Schottelius 2020-02-27 11:40:36 +01:00
parent a58a361254
commit aa59b05a2d
3 changed files with 3 additions and 17 deletions

View file

@ -18,14 +18,12 @@ from django.urls import path, include
from rest_framework import routers
from uncloud_api import views as apiviews
from uncloud_vm import views as vmviews
from opennebula import views as oneviews
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/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)
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
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
]

View file

@ -1,4 +1,3 @@
from django.contrib.auth.models import Group
from django.contrib.auth import get_user_model
from rest_framework import serializers
@ -7,8 +6,3 @@ class UserSerializer(serializers.ModelSerializer):
class Meta:
model = get_user_model()
fields = ['url', 'username', 'email']
class GroupSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Group
fields = ['url', 'name']

View file

@ -7,10 +7,7 @@ from rest_framework import viewsets, permissions, generics
from rest_framework.views import APIView
from rest_framework.response import Response
from uncloud_vm.models import VMProduct
from .models import VMSnapshotProduct
from .serializers import UserSerializer, GroupSerializer, VMSnapshotSerializer, VMSnapshotCreateSerializer
from .serializers import UserSerializer
import inspect
import sys