diff --git a/conntrackt/models.py b/conntrackt/models.py --- a/conntrackt/models.py +++ b/conntrackt/models.py @@ -22,7 +22,7 @@ # Django imports. from django.contrib.admin.utils import NestedObjects from django.core.exceptions import ValidationError -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db import models from django.db.models.query_utils import Q @@ -248,8 +248,8 @@ class Entity(RelatedCollectorMixin, mode name = models.CharField(max_length=100) description = models.TextField(blank=True) - project = models.ForeignKey(Project) - location = models.ForeignKey(Location) + project = models.ForeignKey(Project, on_delete = models.CASCADE) + location = models.ForeignKey(Location, on_delete = models.CASCADE) objects = SearchManager() class Meta: @@ -345,7 +345,7 @@ class Interface(RelatedCollectorMixin, m name = models.CharField(max_length=100, default='eth0') description = models.TextField(blank=True, default='Main network interface.') - entity = models.ForeignKey(Entity) + entity = models.ForeignKey(Entity, on_delete = models.CASCADE) address = models.GenericIPAddressField() netmask = models.GenericIPAddressField(default='255.255.255.255') @@ -407,8 +407,8 @@ class Communication(RelatedCollectorMixi ('ICMP', 'ICMP'), ) - source = models.ForeignKey(Interface, related_name='source_set') - destination = models.ForeignKey(Interface, related_name='destination_set') + source = models.ForeignKey(Interface, related_name='source_set', on_delete = models.CASCADE) + destination = models.ForeignKey(Interface, related_name='destination_set', on_delete = models.CASCADE) protocol = models.CharField(max_length=10, choices=PROTOCOL_CHOICES) port = models.IntegerField(default=0) description = models.TextField(blank=True)