mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Added CSV export for cables
This commit is contained in:
parent
c3db7191d2
commit
1119209fa0
@ -2407,6 +2407,11 @@ class Cable(ChangeLoggedModel):
|
|||||||
|
|
||||||
objects = CableQuerySet.as_manager()
|
objects = CableQuerySet.as_manager()
|
||||||
|
|
||||||
|
csv_headers = [
|
||||||
|
'termination_a_type', 'termination_a_id', 'termination_b_type', 'termination_b_id', 'type', 'status', 'label',
|
||||||
|
'color', 'length', 'length_unit',
|
||||||
|
]
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = (
|
unique_together = (
|
||||||
('termination_a_type', 'termination_a_id'),
|
('termination_a_type', 'termination_a_id'),
|
||||||
@ -2461,6 +2466,20 @@ class Cable(ChangeLoggedModel):
|
|||||||
|
|
||||||
super(Cable, self).save(*args, **kwargs)
|
super(Cable, self).save(*args, **kwargs)
|
||||||
|
|
||||||
|
def to_csv(self):
|
||||||
|
return (
|
||||||
|
'{}.{}'.format(self.termination_a_type.app_label, self.termination_a_type.model),
|
||||||
|
self.termination_a_id,
|
||||||
|
'{}.{}'.format(self.termination_b_type.app_label, self.termination_b_type.model),
|
||||||
|
self.termination_b_id,
|
||||||
|
self.get_type_display(),
|
||||||
|
self.get_status_display(),
|
||||||
|
self.label,
|
||||||
|
self.color,
|
||||||
|
self.length,
|
||||||
|
self.length_unit,
|
||||||
|
)
|
||||||
|
|
||||||
def get_path_endpoints(self):
|
def get_path_endpoints(self):
|
||||||
"""
|
"""
|
||||||
Traverse both ends of a cable path and return its connected endpoints. Note that one or both endpoints may be
|
Traverse both ends of a cable path and return its connected endpoints. Note that one or both endpoints may be
|
||||||
|
Loading…
Reference in New Issue
Block a user