@property def name(self): return self.server.name ### Signals ### # update the node set_state on tinc config update def tinchost_changed(sender, instance, **kwargs): # Do nothing while loading fixtures or running migrations if kwargs.get('raw', False): return if hasattr(instance.content_object, 'update_set_state'): # is a node instance.content_object.update_set_state() post_save.connect(tinchost_changed, sender=TincHost) post_delete.connect(tinchost_changed, sender=TincHost) # Monkey-Patching Section tinc = property(get_tinc) # Hook TincHost support to Node Node.add_to_class('related_tinc', generic.GenericRelation('tinc.TincHost')) Node.add_to_class('tinc', tinc) # Hook TincHost support to Server Server.add_to_class('related_tinc', generic.GenericRelation('tinc.TincHost')) Server.add_to_class('tinc', tinc)