use get_object_or_404 with device
This commit is contained in:
parent
4fe8f4be6e
commit
81b35d9772
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue