mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 01:06:11 -06:00
add primary ip and oob ip checkmark to ip address view
This commit is contained in:
parent
e5cea213c5
commit
b45606d6ba
@ -849,6 +849,32 @@ class IPAddress(PrimaryModel):
|
|||||||
return self.address.version
|
return self.address.version
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_oob_ip(self):
|
||||||
|
if self.assigned_object:
|
||||||
|
if self.family == 4:
|
||||||
|
if self.assigned_object.device.oob_ip4:
|
||||||
|
if self.assigned_object.device.oob_ip4.pk == self.pk:
|
||||||
|
return True
|
||||||
|
if self.family == 6:
|
||||||
|
if self.assigned_object.device.oob_ip6:
|
||||||
|
if self.assigned_object.device.oob_ip6.pk == self.pk:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_primary_ip(self):
|
||||||
|
if self.assigned_object:
|
||||||
|
if self.family == 4:
|
||||||
|
if self.assigned_object.device.primary_ip4:
|
||||||
|
if self.assigned_object.device.primary_ip4.pk == self.pk:
|
||||||
|
return True
|
||||||
|
if self.family == 6:
|
||||||
|
if self.assigned_object.device.primary_ip6:
|
||||||
|
if self.assigned_object.device.primary_ip6.pk == self.pk:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def _set_mask_length(self, value):
|
def _set_mask_length(self, value):
|
||||||
"""
|
"""
|
||||||
Expose the IPNetwork object's prefixlen attribute on the parent model so that it can be manipulated directly,
|
Expose the IPNetwork object's prefixlen attribute on the parent model so that it can be manipulated directly,
|
||||||
|
@ -96,6 +96,14 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Primary IP</td>
|
||||||
|
<td>{% checkmark object.is_primary_ip %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>OOB IP</td>
|
||||||
|
<td>{% checkmark object.is_oob_ip %}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user