12074 fix set location only if present in rack

This commit is contained in:
Arthur 2023-03-31 13:23:04 -07:00
parent 941c4df9d9
commit 7225dbf049

View File

@ -799,7 +799,7 @@ class Device(PrimaryModel, ConfigContextModel):
if is_new and not self.airflow: if is_new and not self.airflow:
self.airflow = self.device_type.airflow self.airflow = self.device_type.airflow
if self.rack: if self.rack and self.rack.location:
self.location = self.rack.location self.location = self.rack.location
super().save(*args, **kwargs) super().save(*args, **kwargs)