urlpath.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:website 作者: hackerspace-ntnu 项目源码 文件源码
def root(cls):
        site = Site.objects.get_current()
        root_nodes = list(
            cls.objects.root_nodes().filter(site=site).select_related_common()
        )
        # We fetch the nodes as a list and use len(), not count() because we need
        # to get the result out anyway. This only takes one sql query
        no_paths = len(root_nodes)
        if no_paths == 0:
            raise NoRootURL(
                "You need to create a root article on site '%s'" %
                site)
        if no_paths > 1:
            raise MultipleRootURLs(
                "Somehow you have multiple roots on %s" %
                site)
        return root_nodes[0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号