# HG changeset patch # User Branko Majic # Date 2013-02-28 23:38:06 # Node ID 6bbf3225dfdd2971f27b88c8b7cd234945068348 # Parent 3d9170ce641a055e24e0e950928eb23b46624cfb Added check to verify that the connecting interfaces in communication belong to same project. diff --git a/conntrackt/models.py b/conntrackt/models.py --- a/conntrackt/models.py +++ b/conntrackt/models.py @@ -210,7 +210,11 @@ class Communication(models.Model): """ if self.source.entity == self.destination.entity: - raise ValidationError('Source and destination entities must differ.') + raise ValidationError('Source and destination entities are identical.') + + if self.source.entity.project != self.destination.entity.project: + raise ValidationError('Source and destination entities do not belong to the same project') + if (self.protocol.upper(), self.protocol.upper()) not in self.PROTOCOL_CHOICES: raise ValidationError('%s is not a supported protocol.' % self.protocol)