mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -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 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):
|
||||
"""
|
||||
Expose the IPNetwork object's prefixlen attribute on the parent model so that it can be manipulated directly,
|
||||
|
@ -96,6 +96,14 @@
|
||||
{% endfor %}
|
||||
</td>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user