diff --git a/netbox/circuits/migrations/0008_circuittermination_interface_protect_on_delete.py b/netbox/circuits/migrations/0008_circuittermination_interface_protect_on_delete.py new file mode 100644 index 000000000..14ee6686d --- /dev/null +++ b/netbox/circuits/migrations/0008_circuittermination_interface_protect_on_delete.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-04-19 17:17 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('circuits', '0007_circuit_add_description'), + ] + + operations = [ + migrations.AlterField( + model_name='circuittermination', + name='interface', + field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='circuit_termination', to='dcim.Interface'), + ), + ] diff --git a/netbox/circuits/models.py b/netbox/circuits/models.py index 6a0380dd5..caa91d1a3 100644 --- a/netbox/circuits/models.py +++ b/netbox/circuits/models.py @@ -150,10 +150,14 @@ class CircuitTermination(models.Model): circuit = models.ForeignKey('Circuit', related_name='terminations', on_delete=models.CASCADE) term_side = models.CharField(max_length=1, choices=TERM_SIDE_CHOICES, verbose_name='Termination') site = models.ForeignKey('dcim.Site', related_name='circuit_terminations', on_delete=models.PROTECT) - interface = models.OneToOneField('dcim.Interface', related_name='circuit_termination', blank=True, null=True) + interface = models.OneToOneField( + 'dcim.Interface', related_name='circuit_termination', blank=True, null=True, on_delete=models.PROTECT + ) port_speed = models.PositiveIntegerField(verbose_name='Port speed (Kbps)') - upstream_speed = models.PositiveIntegerField(blank=True, null=True, verbose_name='Upstream speed (Kbps)', - help_text='Upstream speed, if different from port speed') + upstream_speed = models.PositiveIntegerField( + blank=True, null=True, verbose_name='Upstream speed (Kbps)', + help_text='Upstream speed, if different from port speed' + ) xconnect_id = models.CharField(max_length=50, blank=True, verbose_name='Cross-connect ID') pp_info = models.CharField(max_length=100, blank=True, verbose_name='Patch panel/port(s)')