helpers.py 文件源码

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

项目:wagtail-sharing 作者: cfpb 项目源码 文件源码
def get_sharing_url(page):
    """Get a sharing URL for the latest revision of a page, if available."""
    url_parts = page.get_url_parts()

    if url_parts is None:
        # Page is not routable.
        return None

    site_id, root_url, page_path = url_parts

    site = Site.objects.get(id=site_id)

    try:
        sharing_site = site.sharing_site
    except SharingSite.DoesNotExist:
        # Site is not shared.
        return None

    return sharing_site.root_url + page_path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号