|
|
@@ -794,8 +794,6 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd
|
|
|
raise ValidationError({
|
|
|
'rf_channel_frequency': "Cannot specify custom frequency with channel selected.",
|
|
|
})
|
|
|
- elif self.rf_channel:
|
|
|
- self.rf_channel_frequency = get_channel_attr(self.rf_channel, 'frequency')
|
|
|
|
|
|
# Validate channel width against interface type and selected channel (if any)
|
|
|
if self.rf_channel_width:
|
|
|
@@ -803,8 +801,6 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd
|
|
|
raise ValidationError({'rf_channel_width': "Channel width may be set only on wireless interfaces."})
|
|
|
if self.rf_channel and self.rf_channel_width != get_channel_attr(self.rf_channel, 'width'):
|
|
|
raise ValidationError({'rf_channel_width': "Cannot specify custom width with channel selected."})
|
|
|
- elif self.rf_channel:
|
|
|
- self.rf_channel_width = get_channel_attr(self.rf_channel, 'width')
|
|
|
|
|
|
# VLAN validation
|
|
|
|
|
|
@@ -815,6 +811,16 @@ class Interface(ModularComponentModel, BaseInterface, CabledObjectModel, PathEnd
|
|
|
f"interface's parent device, or it must be global."
|
|
|
})
|
|
|
|
|
|
+ def save(self, *args, **kwargs):
|
|
|
+
|
|
|
+ # Set absolute channel attributes from selected options
|
|
|
+ if self.rf_channel and not self.rf_channel_frequency:
|
|
|
+ self.rf_channel_frequency = get_channel_attr(self.rf_channel, 'frequency')
|
|
|
+ if self.rf_channel and not self.rf_channel_width:
|
|
|
+ self.rf_channel_width = get_channel_attr(self.rf_channel, 'width')
|
|
|
+
|
|
|
+ super().save(*args, **kwargs)
|
|
|
+
|
|
|
@property
|
|
|
def _occupied(self):
|
|
|
return super()._occupied or bool(self.wireless_link_id)
|