use get_object_or_404 with device

This commit is contained in:
Andreas Zweili 2019-08-06 21:46:32 +02:00
parent 4fe8f4be6e
commit 81b35d9772
1 changed files with 1 additions and 1 deletions

View File

@ -19,7 +19,7 @@ def computer_view_permission(old_fuction):
def device_view_permission(old_function):
def new_function(request, device_id, *args, **kwargs):
computer = Device.objects.get(pk=device_id)
device = get_object_or_404(Device, pk=device_id)
customer = Customer.objects.get(pk=device.customer.pk)
user = request.user
if user.has_perm('inventory.view_customer', customer):