Example #1
0
    def save(self, *args, **kwargs):
        super(CatalogItem, self).save(*args, **kwargs)
        self.set_object_id()

        path = self.slug
        if self.parent:
            path = PATH_SEPARATOR.join((self.parent.path, self.slug))

            self.parent.last_child = self
            CatalogItem.objects.filter(pk=self.parent_id).update(last_child=self)

        self.path = path
        CatalogItem.objects.filter(pk=self.pk).update(path=self.path)
        self.store_icon_by_url()
Example #2
0
    def save(self, *args, **kwargs):
        super(CatalogItem, self).save(*args, **kwargs)
        self.set_object_id()

        path = self.slug
        if self.parent:
            path = PATH_SEPARATOR.join((self.parent.path, self.slug))

            self.parent.last_child = self
            CatalogItem.objects.filter(pk=self.parent_id).update(
                last_child=self)

        self.path = path
        CatalogItem.objects.filter(pk=self.pk).update(path=self.path)
        self.store_icon_by_url()
Example #3
0
    def save(self, *args, **kwargs):
        skip_tree_path = kwargs.pop('skip_tree_path', False)
        super(Node, self).save(*args, **kwargs)

        if skip_tree_path:
            return None

        tree_path = self.zerro_filled_pk
        if self.parent:
            tree_path = PATH_SEPARATOR.join((self.parent.tree_path, tree_path))

            self.parent.last_child = self
            Node.objects.filter(pk=self.parent_id).update(last_child=self)

        self.tree_path = tree_path
        Node.objects.filter(pk=self.pk).update(tree_path=self.tree_path)