fix instance detail view in API

This commit is contained in:
Tao Bojlen 2018-08-27 12:43:16 +02:00
parent 303d762854
commit 97a6d1321b
2 changed files with 2 additions and 1 deletions

View file

@ -6,6 +6,7 @@ from apiv1.serializers import InstanceListSerializer, InstanceDetailSerializer
class InstanceViewSet(viewsets.ModelViewSet):
"""API endpoint to view instances"""
lookup_field = 'name'
lookup_value_regex = '[a-zA-Z0-9-_\.]+'
queryset = Instance.objects.all()

View file

@ -59,7 +59,6 @@ INSTALLED_APPS = [
]
MIDDLEWARE = [
'silk.middleware.SilkyMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
@ -67,6 +66,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'silk.middleware.SilkyMiddleware',
]
ROOT_URLCONF = 'backend.urls'