mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Added tenant to import/export of Circuits
This commit is contained in:
@ -2,6 +2,7 @@ from django import forms
|
|||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
|
|
||||||
from dcim.models import Site, Device, Interface, Rack, IFACE_FF_VIRTUAL
|
from dcim.models import Site, Device, Interface, Rack, IFACE_FF_VIRTUAL
|
||||||
|
from tenancy.models import Tenant
|
||||||
from utilities.forms import (
|
from utilities.forms import (
|
||||||
APISelect, BootstrapMixin, BulkImportForm, CommentField, CSVDataField, Livesearch, SmallTextarea, SlugField,
|
APISelect, BootstrapMixin, BulkImportForm, CommentField, CSVDataField, Livesearch, SmallTextarea, SlugField,
|
||||||
)
|
)
|
||||||
@ -160,13 +161,15 @@ class CircuitFromCSVForm(forms.ModelForm):
|
|||||||
error_messages={'invalid_choice': 'Provider not found.'})
|
error_messages={'invalid_choice': 'Provider not found.'})
|
||||||
type = forms.ModelChoiceField(CircuitType.objects.all(), to_field_name='name',
|
type = forms.ModelChoiceField(CircuitType.objects.all(), to_field_name='name',
|
||||||
error_messages={'invalid_choice': 'Invalid circuit type.'})
|
error_messages={'invalid_choice': 'Invalid circuit type.'})
|
||||||
|
tenant = forms.ModelChoiceField(Tenant.objects.all(), to_field_name='name', required=False,
|
||||||
|
error_messages={'invalid_choice': 'Tenant not found.'})
|
||||||
site = forms.ModelChoiceField(Site.objects.all(), to_field_name='name',
|
site = forms.ModelChoiceField(Site.objects.all(), to_field_name='name',
|
||||||
error_messages={'invalid_choice': 'Site not found.'})
|
error_messages={'invalid_choice': 'Site not found.'})
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Circuit
|
model = Circuit
|
||||||
fields = ['cid', 'provider', 'type', 'site', 'install_date', 'port_speed', 'commit_rate', 'xconnect_id',
|
fields = ['cid', 'provider', 'type', 'tenant', 'site', 'install_date', 'port_speed', 'commit_rate',
|
||||||
'pp_info']
|
'xconnect_id', 'pp_info']
|
||||||
|
|
||||||
|
|
||||||
class CircuitImportForm(BulkImportForm, BootstrapMixin):
|
class CircuitImportForm(BulkImportForm, BootstrapMixin):
|
||||||
|
@ -92,6 +92,7 @@ class Circuit(CreatedUpdatedModel):
|
|||||||
self.cid,
|
self.cid,
|
||||||
self.provider.name,
|
self.provider.name,
|
||||||
self.type.name,
|
self.type.name,
|
||||||
|
self.tenant.name if self.tenant else '',
|
||||||
self.site.name,
|
self.site.name,
|
||||||
self.install_date.isoformat() if self.install_date else '',
|
self.install_date.isoformat() if self.install_date else '',
|
||||||
str(self.port_speed),
|
str(self.port_speed),
|
||||||
|
@ -43,6 +43,11 @@
|
|||||||
<td>Circuit type</td>
|
<td>Circuit type</td>
|
||||||
<td>Transit</td>
|
<td>Transit</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Tenant</td>
|
||||||
|
<td>Name of tenant (optional)</td>
|
||||||
|
<td>Strickland Propane</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Site</td>
|
<td>Site</td>
|
||||||
<td>Site name</td>
|
<td>Site name</td>
|
||||||
@ -76,7 +81,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h4>Example</h4>
|
<h4>Example</h4>
|
||||||
<pre>IC-603122,TeliaSonera,Transit,ASH-4,2016-02-23,10000,2000,937649,PP8371 ports 13/14</pre>
|
<pre>IC-603122,TeliaSonera,Transit,Strickland Propane,ASH-4,2016-02-23,10000,2000,937649,PP8371 ports 13/14</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Reference in New Issue
Block a user