diff --git a/netbox/circuits/models.py b/netbox/circuits/models.py index 584601e62..738cefb6f 100644 --- a/netbox/circuits/models.py +++ b/netbox/circuits/models.py @@ -44,6 +44,15 @@ class Provider(models.Model): def get_absolute_url(self): return reverse('circuits:provider', args=[self.slug]) + def to_csv(self): + return ','.join([ + self.name, + self.slug, + str(self.asn) if self.asn else '', + self.account, + self.portal_url, + ]) + class CircuitType(models.Model): """ @@ -87,3 +96,16 @@ class Circuit(models.Model): def get_absolute_url(self): return reverse('circuits:circuit', args=[self.pk]) + + def to_csv(self): + return ','.join([ + self.cid, + self.provider.name, + self.type.name, + self.site.name, + self.install_date.isoformat() if self.install_date else '', + str(self.port_speed), + str(self.commit_rate) if self.commit_rate else '', + self.xconnect_id, + self.pp_info, + ]) diff --git a/netbox/templates/circuits/circuit_list.html b/netbox/templates/circuits/circuit_list.html index 388efa609..2b40e0df0 100644 --- a/netbox/templates/circuits/circuit_list.html +++ b/netbox/templates/circuits/circuit_list.html @@ -11,19 +11,7 @@ Add a circuit {% endif %} - {% if export_templates %} -
- - -
- {% endif %} + {% include 'inc/export_button.html' with obj_type='circuits' %}

Circuits

diff --git a/netbox/templates/circuits/provider_list.html b/netbox/templates/circuits/provider_list.html index 7f96033fb..2b5bfc68c 100644 --- a/netbox/templates/circuits/provider_list.html +++ b/netbox/templates/circuits/provider_list.html @@ -10,19 +10,7 @@ Add a provider {% endif %} - {% if export_templates %} -
- - -
- {% endif %} + {% include 'inc/export_button.html' with obj_type='providers' %}

Providers