code: def save(self, **kwargs):
          "Override save() to construct tree_path based on the category's parent."
          old_tree_path = self.tree_path
          if self.tree_parent:
              if self.tree_parent.tree_path:
                  self.tree_path = '%s/%s' % (self.tree_parent.tree_path, self.slug)
              else:
                  self.tree_path = self.slug
          else:
              self.tree_path = ''
          Category.objects.clear_cache()
          super(Category, self).save(**kwargs)
          if old_tree_path != self.tree_path:
              # the tree_path has changed, update children
              children = Category.objects.filter(tree_parent=self)
              for child in children:
                  child.save(force_update=Truef save(self, **kwargs):
          "Override save() to construct tree_path based on the category's parent."
          old_tree_path = self.tree_path
          if self.tree_parent:
              if self.tree_parent.tree_path:
                  self.tree_path = '%s/%s' % (self.tree_parent.tree_path, self.slug)
              else:
                  self.tree_path = self.slug
          else:
              self.tree_path = ''
          Category.objects.clear_cache()
          super(Category, self).save(**kwargs)
          if old_tree_path != self.tree_path:
              # the tree_path has changed, update children
              children = Category.objects.filter(tree_parent=self)
              for child in children:
                  child.save(force_update=True)
docs: Override save() to construct tree_path based on the category's parent.