Beispiel #1
0
def __xos_save_base(self, *args, **kwds):
    """ Hack to allow the creation of NodeLabel objects from outside core 
        until the ORM is extended with support for ManyToMany relations.
    """

    if self.name and '###' in self.name:
        from core.models import Node

        self.name, node_id_str = self.name.split('###')
        node_ids = map(int, node_id_str.split(','))

        for node_id in node_ids:
            node = Node.get(node_id)
            self.node.add(node)
Beispiel #2
0
    def save(self, *args, **kwargs):
        """ Hack to allow the creation of NodeLabel objects from outside core
            until the ORM is extended with support for ManyToMany relations.
        """

        if self.name and "###" in self.name:
            from core.models import Node

            self.name, node_id_str = self.name.split("###")
            node_ids = map(int, node_id_str.split(","))

            for node_id in node_ids:
                node = Node.get(node_id)
                self.node.add(node)

        super(NodeLabel, self).save(*args, **kwargs)