diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-11-12 12:54:20 -0500 |
---|---|---|
committer | Brandon Lo <lobrandon1217@gmail.com> | 2020-01-28 13:28:34 -0500 |
commit | 899e1a4baa95d0bc6f0eef34de66f0e257174878 (patch) | |
tree | 2fbc99070b2fe2d75135ca5f899ed14b12639856 /src/account/views.py | |
parent | 30a535d7e9bdc0e3cf637207c0c100a16db81586 (diff) |
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 <pberberian@iol.unh.edu>
Diffstat (limited to 'src/account/views.py')
-rw-r--r-- | src/account/views.py | 6 |
1 files changed, 3 insertions, 3 deletions
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('') |