0001_initial.py 文件源码

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

项目:wagtail-translation 作者: skirsdeda 项目源码 文件源码
def url_path_fix(apps, schema_editor):
    # cannot use apps.get_model here
    # because Page instances wouldn't have set_url_path method
    from wagtail.wagtailcore.models import Page

    url_path_fields = get_translation_fields('url_path')
    for page in Page.objects.order_by('path').iterator():
        page.set_url_path(page.get_parent())
        # make sure descendant page url paths are not updated at this point
        # because it would fail
        page.save(update_fields=url_path_fields)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号