fixed so that ip-addresses that are associated to an interface shows the hostname of the interfaces' host in the drop-down list in host

This commit is contained in:
Tor Martin Slåen committed 2011-04-21 11:45:11 +02:00
1 parent d5ffc7fca3
commit 6d174e4207
1 file changed
+4 -1
+4 -1
View File
@@ -249,7 +249,10 @@ class Ip4Address(models.Model):
address = models.IPAddressField()
def __unicode__(self):
return self.address
if self.interface_set.count() == 0:
return self.address
else:
return "%s (%s)" % (self.address, self.interface_set.get().host.hostname )
def assigned_to_host(self):
self.interface_set.get().host