From 899e1a4baa95d0bc6f0eef34de66f0e257174878 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Tue, 12 Nov 2019 12:54:20 -0500 Subject: Begin Resource Refactor Begins the Resource Refactor by creating new interfaces to the resources through a Resource super class and using that new interface in the api Change-Id: I15a8179bfe915d2cde6d658d056e11cbd2c70e43 Signed-off-by: Parker Berberian --- src/account/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/account') diff --git a/src/account/views.py b/src/account/views.py index 2b4eccb..5b91550 100644 --- a/src/account/views.py +++ b/src/account/views.py @@ -33,7 +33,7 @@ from account.forms import AccountSettingsForm from account.jira_util import SignatureMethod_RSA_SHA1 from account.models import UserProfile from booking.models import Booking -from resource_inventory.models import GenericResourceBundle, ConfigBundle, Image, Host +from resource_inventory.models import GenericResourceBundle, ConfigBundle, Image @method_decorator(login_required, name='dispatch') @@ -229,7 +229,7 @@ def account_images_view(request): public_images = Image.objects.filter(public=True) used_images = {} for image in my_images: - if Host.objects.filter(booked=True, config__image=image).exists(): + if image.in_use(): used_images[image.id] = "true" context = { "title": "Images", @@ -286,7 +286,7 @@ def image_delete_view(request, image_id=None): if image.public or image.owner.id != request.user.id: return HttpResponse('no') # 403? # check if used in booking - if Host.objects.filter(booked=True, config__image=image).exists(): + if image.in_use(): return HttpResponse('no') # 403? image.delete() return HttpResponse('') -- cgit 1.2.3-korg