def rebuild_tree(modeladmin, request, queryset=None):
    """
    Rebuilds whole tree in database using `parent` link.
    """
    tree = FileNode.tree.rebuild()
    messages.success(request, message=_('The node tree was rebuilt.'))
    return HttpResponseRedirect('')