From d6176d8756c12fa3818203892ecd9c6e9dd016f7 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Wed, 11 Oct 2017 13:55:09 +0200 Subject: [PATCH] Allow API requests for mnt-lower, too --- api/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/views.py b/api/views.py index 68dcf1b..ea4e854 100644 --- a/api/views.py +++ b/api/views.py @@ -28,7 +28,7 @@ def asblockFreeAS(request): try: mnts = request.user.maintainer_set.all() - block = ASBlock.objects.filter(mnt_by__in=mnts).distinct().get(handle=blockName) + block = ASBlock.objects.filter(Q(mnt_by__in=mnts) | Q(mnt_lower__in=mnts)).distinct().get(handle=blockName) if block.asblock_set.count() > 0: raise ValidationError("AS Block already has sub AS Blocks") if block.asnumber_set.count() > 0: @@ -72,7 +72,7 @@ def freeSubnet(request): parentRange = None try: mnts = request.user.maintainer_set.all() - parentRange = InetNum.objects.filter(mnt_by__in=mnts).distinct().get(handle=parentRangeName) + parentRange = InetNum.objects.filter(Q(mnt_by__in=mnts) | Q(mnt_lower__in=mnts)).distinct().get(handle=parentRangeName) except InetNum.DoesNotExist: raise ValidationError("Parent range does not exist / is not maintained by you")