Allow the DeviceBay to be updated if current_bay is self

If the current_bay of the installed device is the same as self, then the operation is a valid update.
This commit is contained in:
hSaria 2020-01-02 13:55:22 +00:00 committed by GitHub
parent 2bef69cc02
commit bf654526c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2597,7 +2597,7 @@ class DeviceBay(ComponentModel):
# Check that the installed device is not already installed elsewhere
if self.installed_device:
current_bay = DeviceBay.objects.filter(installed_device=self.installed_device).first()
if current_bay:
if current_bay != self:
raise ValidationError({
'installed_device': "Cannot install the specified device; device is already installed in {}".format(
current_bay