Skip to content

Commit

Permalink
Don't delete network if gateway address is removed (allegro#2959)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurek authored Feb 20, 2017
1 parent 615d68b commit a3f1ce1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/ralph/networks/migrations/0010_auto_20170216_1230.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('networks', '0009_auto_20160823_0921'),
]

operations = [
migrations.AlterField(
model_name='network',
name='gateway',
field=models.ForeignKey(to='networks.IPAddress', blank=True, on_delete=django.db.models.deletion.SET_NULL, verbose_name='Gateway address', null=True, related_name='gateway_network'),
),
]
2 changes: 1 addition & 1 deletion src/ralph/networks/models/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class Network(
address._filter_title = _('Network Class')
gateway = models.ForeignKey(
'IPAddress', verbose_name=_('Gateway address'), null=True, blank=True,
related_name='gateway_network'
related_name='gateway_network', on_delete=models.SET_NULL,
)
remarks = models.TextField(
verbose_name=_('remarks'),
Expand Down

0 comments on commit a3f1ce1

Please sign in to comment.