1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #2200: Replaced detail_route API view decorator with action (DRF change)

This commit is contained in:
Jeremy Stretch
2018-06-29 11:48:21 -04:00
parent 35d58d2f7c
commit b9bdd666da
6 changed files with 17 additions and 17 deletions

View File

@@ -3,7 +3,7 @@ from __future__ import unicode_literals
from django.conf import settings
from django.shortcuts import get_object_or_404
from rest_framework import status
from rest_framework.decorators import detail_route
from rest_framework.decorators import action
from rest_framework.exceptions import PermissionDenied
from rest_framework.response import Response
@@ -77,7 +77,7 @@ class PrefixViewSet(CustomFieldModelViewSet):
serializer_class = serializers.PrefixSerializer
filter_class = filters.PrefixFilter
@detail_route(url_path='available-prefixes', methods=['get', 'post'])
@action(detail=True, url_path='available-prefixes', methods=['get', 'post'])
def available_prefixes(self, request, pk=None):
"""
A convenience method for returning available child prefixes within a parent.
@@ -137,7 +137,7 @@ class PrefixViewSet(CustomFieldModelViewSet):
return Response(serializer.data)
@detail_route(url_path='available-ips', methods=['get', 'post'])
@action(detail=True, url_path='available-ips', methods=['get', 'post'])
def available_ips(self, request, pk=None):
"""
A convenience method for returning available IP addresses within a prefix. By default, the number of IPs